Package Camelot :: Package camelot :: Package admin :: Package validator :: Module object_validator :: Class ObjectValidator |
[frames] | no frames]

# Class ObjectValidator

source code

A validator class for normal python objects. By default this validator declares all objects valid. Subclass this class and overwrite it's objectValidity method to change it's behaviour.

Instance Methods
__init__(self, admin, model, initial_validation=False) since this might take a lot of time on large collections. | source code
validate_all_rows(self) Force validation of all rows in the model | source code
validate_invalid_rows(self) | source code
layout_changed(self) | source code
data_changed(self, from_index, thru_index) | source code
objectValidity(self, entity_instance) empty list if object is valid | source code
number_of_invalid_rows(self) Returns: the number of invalid rows in a model, as they have been verified | source code
isValid(self, row) Verify if a row in a model is 'valid' meaning it could be flushed to the database | source code
validityMessages(self, row) | source code
validityDialog(self, row, parent) Return a QDialog that asks the user to discard his changes or continue to edit the row until it is valid. | source code
Inherited from `PyQt4.QtCore.QObject`: `blockSignals`, `childEvent`, `children`, `connect`, `connectNotify`, `customEvent`, `deleteLater`, `destroyed`, `disconnect`, `disconnectNotify`, `dumpObjectInfo`, `dumpObjectTree`, `dynamicPropertyNames`, `emit`, `event`, `eventFilter`, `findChild`, `findChildren`, `inherits`, `installEventFilter`, `isWidgetType`, `killTimer`, `metaObject`, `moveToThread`, `objectName`, `parent`, `property`, `pyqtConfigure`, `receivers`, `removeEventFilter`, `sender`, `setObjectName`, `setParent`, `setProperty`, `signalsBlocked`, `startTimer`, `thread`, `timerEvent`, `tr`, `trUtf8` Inherited from `sip.simplewrapper`: `__delattr__`, `__getattribute__`, `__new__`, `__setattr__` Inherited from `object`: `__format__`, `__hash__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Class Variables
| validity_changed_signal = ``'``2validityChanged``'``
Inherited from `PyQt4.QtCore.QObject`: `staticMetaObject`

Properties
Inherited from `object`: `__class__`

Method Details

### __init__(self, admin, model, initial_validation=False) (Constructor) | source code
since this might take a lot of time on large collections. Parameters: `verifiy_initial_validity` - do an inital check to see if all rows in a model are valid, defaults to False, Overrides: object.__init__

### objectValidity(self, entity_instance) | source code
empty list if object is valid Returns: list of messages explaining invalid data

### number_of_invalid_rows(self) | source code
Returns: the number of invalid rows in a model, as they have been verified