Commit Graph

39 Commits

Author SHA1 Message Date
Roberto Rosario
a75a4edf21 Issue #39, Finish capitalizing source text messages 2014-10-10 02:29:37 -04:00
Roberto Rosario
9662d14e9c Issue #40, finish remaining '/' hardcoded redirects 2014-10-09 20:05:42 -04:00
Roberto Rosario
8bac1525be PEP8 cleanups 2014-10-08 19:39:16 -04:00
Roberto Rosario
50e143e754 Fix indentation 2014-10-08 18:15:19 -04:00
Roberto Rosario
97dcf507ab PEP8 cleanups 2014-10-08 18:14:05 -04:00
Roberto Rosario
379a34dabe Translation file synchronization 2014-10-08 17:31:51 -04:00
Roberto Rosario
ad7ae3dcfa Issue #56, Remove sidebar help templates and navigation function to register them 2014-10-08 10:11:04 -04:00
Roberto Rosario
78ecee7266 Merge branch 'gwalborn-master' into test
Conflicts:
	mayan/apps/metadata/forms.py
2014-10-07 13:47:02 -04:00
Roberto Rosario
6896b29b89 Merge branch 'master' of https://github.com/gwalborn/mayan-edms into gwalborn-master 2014-10-07 13:44:36 -04:00
Roberto Rosario
a85b3b1526 Add metadata app API endpoints 2014-10-07 08:57:37 -04:00
Roberto Rosario
74cf4c413f Import cleanups, reorganization, PEP8 cleanups 2014-10-02 02:01:08 -04:00
Roberto Rosario
06dd1b3368 Issue #39, Explicitly captalize string now that they are not capitalized blindly by the templates 2014-10-02 01:17:27 -04:00
Roberto Rosario
437c74a024 Merge branch 'master' into development 2014-10-01 05:19:51 -04:00
Ford Guo
fa78a30413 change zh_CN po mo 2014-09-30 11:00:39 +08:00
Ford Guo
5d10eab278 update zh_CN 2014-09-29 14:28:50 +08:00
Ford Guo
e4cdc69ca1 add zh_CN mo files 2014-09-26 13:54:49 +08:00
Ford Guo
b15100c2ea add zh_CN language 2014-09-26 11:43:53 +08:00
Gary Walborn
9cd3753746 Adds ability to validate and normalize metadata.
I felt that it would be very handy to be able to validate
user-supplied metadata.  It occurred to me that if a metadata
type had an explicit list of options, it would need no validation.
Therefore, the "lookup" field of a metadata type could be overloaded
to provide EITHER a list of items that could be selected by the user
OR a function to provide data validation.  The system, therefore,
would need to be able to discriminate between a lookup function
and a validation function.

    To this end, I created a global variable
('METADATA_AVAILABLE_VALIDATORS') to contain a dictionary of
available validation functions.  If the name specified in
'metadata_type.lookup' is present in METADATA_AVAILABLE_VALIDATORS,
the system treats the function as a validator.  Otherwise, the
function is treated as a generator of an iterable value providing
the choices for the user.

  Django contains a pre-existing mechanism to support field
validation.  A validator has a single argument (the data to
be validated).  If the argument to the validator is valid,
the validator simply returns.  If there is a problem with
the data, the validator raises a 'ValidationError' exception
and passes an error message which is then displayed by Django
as a mouseover tip in the browser. Validators to be used
with Mayan-EDMS may follow this convention (i.e., take a
single argument and raise an exception if the validation
fails).  The validators in Mayan-EDMS, however, may actually
do more!

  If a validator function RETURNS a value, that value is used
in place of the original data.  This allows the validator to
make data conform to a valid value or to "normalize" a value
before it is stored in the database.  This allows for more
uniform metadata and improves the ability to index on the
metadata values.  Lets take at a look at an example of this
functionality.

  Assume that a document requires a date (perhaps, an
"original posting date").  We can have a 'metadata_type" of
"original_posting_date", and we can create a validator with
the name "is_valid_posting_date".  The validator function
(which is placed in a module read by the settings routine),
contains the function:

def is_valid_posting_date(value):
   from dateutil import parser
   import datetime
   from django.core.exceptions import ValidationError

   try:
      dt = parser.parse(value)
   except ValueError:
      raise ValidationError('Invalid date')
   return dt.date().isoformat()

This is placed in a dictionary in the user's
settings file, thus:

import my_settings
METADATA_AVAILABLE_VALIDATORS = {
  'is_valid_posting_date':my_settings.is_valid_posting_date }

The user creates a metadata type called "original_posting_date"
with a label of "Original Posting Date" and a 'lookup' value
of "is_valid_posting_date".  When the metadata form is filled
in and submitted, the date value is validated by our validator.
Since the python 'parser' function accepts many kinds of input,
the user can enter (for example) '9/1/2014', '2014/10/2',
or even 'Feb 4, 2001'.  If the user enters something that
does not (as far as python is concerned) represent a valid date,
the system will raise a "ValidationError" and the form will
be re-displayed with an appropriate error message.  If, however,
the data is valid, the valid of the field (and, hence, stored
in the database) will be "normalized" to ISO format YYYY-MM-DD.
This allows consistent lookup and indexing regardless of the
users particular idiosyncracies.
2014-09-22 12:30:15 -04:00
Roberto Rosario
b761037d99 Move all settings files from <app>/conf/settings.py to <app>/settings.py 2014-09-11 05:02:40 -04:00
Roberto Rosario
77acb809b9 Update view references to include namespaces 2014-09-06 17:28:40 -04:00
Roberto Rosario
5caf616707 German translation files update 2014-09-05 14:40:15 -04:00
Roberto Rosario
d7aef36442 Add url namespacing to the checkouts, linking, metadata, sources and tags apps 2014-08-26 04:06:09 -04:00
Roberto Rosario
b42e9badf6 Move common templates to apps/main/templates/main/* 2014-08-26 02:44:49 -04:00
Roberto Rosario
01a0d69a5f Generate new source language files 2014-07-31 20:27:52 -04:00
Roberto Rosario
b98dbd83da Synchronize language translations 2014-07-28 01:22:21 -04:00
Roberto Rosario
7321b12c7d Update remaining exception syntaxes 2014-07-20 22:44:12 -04:00
Roberto Rosario
e9717d9bdd Add reminder to add functionality 2014-07-20 17:25:15 -04:00
Roberto Rosario
66fd17a3fb Remove the translatable text manipulation, add remarks 2014-07-20 16:55:30 -04:00
Roberto Rosario
6b169b4526 Modernize exception handling, and improves Python 3.x compatibility 2014-07-20 16:42:30 -04:00
Roberto Rosario
78bf95f25f Update all the source string files 2014-07-03 21:38:25 -04:00
Roberto Rosario
6a659741af PEP8 cleanups 2014-06-30 00:57:53 -04:00
Roberto Rosario
d640eacec8 Update usage of datetime.now to Django timezone aware now() 2014-06-29 17:00:07 -04:00
Roberto Rosario
ecb6733cd4 PEP8 cleanups, unused imports cleanups 2014-06-29 14:14:27 -04:00
Roberto Rosario
3b73936723 Update patterns, url imports in all of the project's urls.py files 2014-06-26 15:27:03 -04:00
Roberto Rosario
5e3d5c7fcb Use metadata model's related name to address a document's metadata instances 2014-06-25 03:01:27 -04:00
Roberto Rosario
73245e66f4 Update and enable all language translations 2014-06-21 02:01:16 -04:00
Roberto Rosario
cf49f64676 Romanian language translation sync and enabling 2014-06-21 00:23:30 -04:00
Roberto Rosario
076797ff24 Added Bosnian translation files and enable Bosnian language selection 2014-06-21 00:16:38 -04:00
Roberto Rosario
ec1745b50b Initial changes to support the new Django 1.6 project structure 2014-06-15 13:13:21 +02:00