Home | Trees | Index | Help |
|
---|
Package aquarium :: Package util :: Module FormValid :: Class Field |
|
This class does the majority of the work. A field has many keyword args that can be set at instantiation that define how the field is validated. In addition there are two required parameters.
Required parameters:
Optional parameters:
Method Summary | |
---|---|
__init__(self,
name,
errorMsg,
**kargs)
| |
__repr__(self)
| |
Attempts to validate this field. | |
Attempt to cast the data if we're supposed to | |
Strips value, if we're supposed to as defined by the strip karg. | |
Validates dependencies, if any. | |
Call the function callback with self.value if it is defined. | |
Attempt to match against the regex object, if it exists |
Method Details |
---|
validate(self, values)Attempts to validate this field. Because of dependencies it is required that "values" be passed in as a dict object containing, at a minimum, access to values for all Fields in this Field and its dependencies. As a postcondition, self.result is a dictionary containing all of the Fields we validated (valid or invalid does not matter). The dict is indexed by field name and contiains a Field object. The value property represents the value after casting (if applicable). Other properties include the errorMsg, and whether or not the field is invalid. Dependencies of a field, if validated, are returned as part of this dictionary. There is no nesting, so the multi-level paradigm used to enter a form is lost on return; the results are flattened. |
_cast(self)Attempt to cast the data if we're supposed to |
_strip(self)Strips value, if we're supposed to as defined by the strip karg. |
_validate_dependencies(self, values)Validates dependencies, if any. Loop over the items in the dependents list, if the regex matches attempt validation of the form, bubble up the results. Otherwise, ignore the form. |
_validate_function(self)Call the function callback with self.value if it is defined. Function may also be a list of functions. The function should return True on success, False on failure. Function should not raise any exceptions that it does not catch itself. |
_validate_regex(self)Attempt to match against the regex object, if it exists |
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Mon Jan 1 16:34:19 2007 | http://epydoc.sf.net |