class EmailField(colander.SchemaNode): oid = "email" schema_type = colander.String widget = deform.widget.TextInputWidget() preparer = [prepare_ignored] validator = colander.Any(colander.Email(), colander.Regex(r'^IGNORED\Z', ''))
class CodeField(colander.SchemaNode): oid = "code" schema_type = colander.String widget = deform.widget.HiddenWidget() preparer = [prepare_ignored] validator = colander.Any(colander.Regex(r'^A\d{10}\Z'), colander.Regex(r'^IGNORED\Z', ''))
class HeaderQuotedInteger(HeaderField): """Integer between "" used in precondition headers.""" schema_type = colander.String error_message = "The value should be integer between double quotes" validator = colander.Any( colander.Regex('^"([0-9]+?)"$', msg=error_message), colander.Regex('\*')) def deserialize(self, cstruct=colander.null): param = super(HeaderQuotedInteger, self).deserialize(cstruct) if param is colander.drop or param == '*': return param return int(param[1:-1])
class OidField(colander.SchemaNode): oid = "oid" schema_type = colander.String widget = deform.widget.HiddenWidget() preparer = [prepare_ignored] validator = colander.Any(colander.uuid, colander.Regex(r'^IGNORED\Z', ''))