Dict Validator


converter: initial simple value converter, for example “180” to 180, or to 180.0, and or “” to None

filter(s): convert value to another (complex) format value, for example “22/5/2013” to datetime(22,5,2013)

validator: validate a value and return value or raise exception

serialization: serialize value.

Order of converter, filters and validators?

validators and filters and converter may raise exceptions

step 1: SampleModel(data)

Model get raw_data as a dict and then pass the value of each key of dict to a corresponding field of Model.

every field try to convert given value to a python data object.

for example for this input {‘service_name’: 123} for service_name field as StringType in Model,

it will converted to {‘service_name’: u’123’}

also exceptions may be raised here, for example if we given {‘service_name’: 12.3} to Model, then it will

raise schematics.exceptions.ModelConversionError(u”Couldn’t interpret value as string.”) exception.

at end, converted data is accessible from _data attribute of Model instance: SampleModel(data)._data

step 2: SampleModel(data).validate() The converted data that is in _data pass to each validator or validators of field.

in evey validation, before validate a value, the value will pass to convert method of filed, and _data will update for that value, if validation passed.

looks at: /usr/local/lib/python2.7/dist-packages/schematics/


install libnotify, python-gobject packages.

from gi.repository import Notify
Notify.init ("Hello world") ("Hello world","This is an example notification.","dialog-information") ()

You may also use notify-send (on Debian-based systems, install the libnotify-bin package):

notify-send -i 'dialog-information' 'Summary' '<b><font color=red>Message body.'

also kdialog’s passive popup option can be used:

kdialog --passivepopup <text> <timeout>
kdialog --passivepopup 'This is a notification' 5


npyscreen Urwid blessed

Install lxml on pyenv (virtual env)