mayan-edms/mayan-edms — pull request #45 by gwalborn (2014-09-15 18:21:17+00:00)
Title: Allow validation of metadata values. 

"METADATA_AVAILABLE_VALIDATORS" to store allowable functions. When
processing the metadata form, the "lookup" field of the "metadata_type"
is checked to see if it is a key in "METADATA_AVAILABLE_VALIDATORS". If
it is, the function entered in "metadata_type.lookup" is treated as a
validator for the metadata value. If not, it is treated as a function
that generates a list of valid metadata value choices. The added
function "clean_value" obtains the "metadata_type.lookup" value and
applies any such function to the "cleaned_data" value. The validator
may return new data or may simply raise a "ValidationError", which
causes a re-display of the web page.