validator Package — Camelot documentation

### Navigation

- index
- modules |
- Camelot documentation »

# validator Package

## `validator` Package

Validator classes validate data before their GUI representation is closed by the user. The validator class also takes care of informing the user where the data is invalid.

This prevents the user from entering invalid data into the model or flushing it to the database.

## `entity_validator` Module

class `camelot.admin.validator.entity_validator.` `EntityValidator`(admin, model, initial_validation=False)

  Bases: `camelot.admin.validator.object_validator.ObjectValidator`

  A validator class validates an entity before flushing it to the database and provides the user with feedback if the entity is not ready to flush

## `object_validator` Module

class `camelot.admin.validator.object_validator.` `ObjectValidator`(admin, model, initial_validation=False)

  Bases: `PyQt4.QtCore.QObject`

  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.

  `data_changed`(from_index, thru_index)
  `isValid`(row)

    Verify if a row in a model is ‘valid’ meaning it could be flushed to the database

  `layout_changed`()
  `number_of_invalid_rows`()

    Returns: | the number of invalid rows in a model, as they have been verified

  `objectValidity`(entity_instance)

    Returns: | list of messages explaining invalid data

    empty list if object is valid

  `validate_all_rows`()

    Force validation of all rows in the model

  `validate_invalid_rows`()
  `validityDialog`(row, parent)

    Return a QDialog that asks the user to discard his changes or continue to edit the row until it is valid.

  `validityMessages`(row)
  `validity_changed_signal`

### Navigation

- index
- modules |
- Camelot documentation »

Comments
blog comments powered by Disqus