def __init__(self, source): super(MyEditor, self).__init__(source, self.fields) self.name.validate(lambda v: validator.to_string(v, strip=True). not_empty().to_string()) self.age.validate(lambda v: validator.to_int(v).lesser_than(50). greater_than(0).to_int())
def __init__(self, title, description, save_template_func): self.save_template_func = save_template_func self.title = editor.Property(title) self.title.validate( lambda v: nagare_validator.to_string(v).not_empty()) self.description = editor.Property(description) self.shared = editor.Property(False).validate(validator.BoolValidator)
def __init__(self, name): """Initialization In: - ``name`` -- initial value of the text field """ # Create a property. The text must be not empty self.name = editor.Property(name).validate(validator.to_string(strip=True).not_empty())
def __init__(self, names): """Initialization Create an editor property for each names In: - ``names`` -- list of name to edit """ self.names = [editor.Property(name).validate(validator.to_string(strip=True).not_empty()) for name in names]
def __init__(self, name): """Initialization In: - ``name`` -- initial value of the text field """ # Create a property. The text must be not empty self.name = editor.Property(name).validate( validator.to_string(strip=True).not_empty())
def __init__(self): self.title = editor.Property(None) self.img = editor.Property(None) # The validation functions are added: # # - the title must be a not empty string # - a image must be uploaded self.title.validate(validator.to_string().not_empty().to_string()) self.img.validate(self.validate_img)
def __init__(self, columns_count): """Initialization In: - ``board`` -- the board the new column will belong """ self.columns_count = columns_count self.index = editor.Property(u'').validate(nagare_validator.to_int) self.title = editor.Property(u'') self.title.validate(lambda v: nagare_validator.to_string(v.strip()).not_empty(_(u'''Can't be empty'''))) self.nb_cards = editor.Property(u'').validate(self.validate_nb_cards)
def __init__(self, columns_count): """Initialization In: - ``board`` -- the board the new column will belong """ self.columns_count = columns_count self.index = editor.Property(u'').validate(nagare_validator.to_int) self.title = editor.Property(u'') self.title.validate(lambda v: nagare_validator.to_string(v).not_empty(_(u'''Can't be empty'''))) self.nb_cards = editor.Property(u'').validate(self.validate_nb_cards)
def __init__(self, names): """Initialization Create an editor property for each names In: - ``names`` -- list of name to edit """ self.names = [ editor.Property(name).validate( validator.to_string(strip=True).not_empty()) for name in names ]
def __init__(self, target): """Initialization Create a ``editor.property`` for each ``self.fields`` of the target object In: - ``target`` -- the object to edit """ super(FormEditor, self).__init__(target, self.fields) # Set the conversion and validation rules on the properties self.age.validate(validator.to_int().lesser_than(50).greater_than(10)) self.area.validate(validator.to_string(strip=True).not_empty().match(r'^[a-d]+$')) # A property can also be manually created self.file = editor.Property().validate(self.validate_file) # An editor can have more properties than the attributes of the target object self.confirm = editor.Property('').validate(self.validate_confirm)
def __init__(self, target): """Initialization Create a ``editor.property`` for each ``self.fields`` of the target object In: - ``target`` -- the object to edit """ super(FormEditor, self).__init__(target, self.fields) # Set the conversion and validation rules on the properties self.age.validate(validator.to_int().lesser_than(50).greater_than(10)) self.area.validate( validator.to_string(strip=True).not_empty().match(r'^[a-d]+$')) # A property can also be manually created self.file = editor.Property().validate(self.validate_file) # An editor can have more properties than the attributes of the target object self.confirm = editor.Property('').validate(self.validate_confirm)
def __init__(self, source): super(MyStringEditor4, self).__init__(source) self.name.validate( lambda v: validator.to_string(v, strip=True).length_equal( 5, msg="test7 - Length must be %(len)d characters"))
def __init__(self, source): super(MyStringEditor3, self).__init__(source) self.name.validate( lambda v: validator.to_string(v, strip=True).shorter_than( 5, msg="test6 - Length must be shorter than %(max)d characters"))
def __init__(self, source): super(MyStringEditor2, self).__init__(source) self.name.validate(lambda v: validator.to_string(v, strip=True).match( r'^[a-d]+$', msg="test5 - Incorrect format"))
def __init__(self, source): super(MyStringEditor1, self).__init__(source) self.name.validate( lambda v: validator.to_string(v, strip=True).not_empty())
def __init__(self, source): super(MyStringEditor5, self).__init__(source) self.name.validate(lambda v: validator.to_string(v, strip=True).longer_than(5).shorter_or_equal_than(8).not_empty().match(r'^[1-9]+$'))
def __init__(self): self.title = editor.Property(None) self.img = editor.Property(None) self.title.validate(validator.to_string().not_empty().to_string()) self.img.validate(self.validate_img)
def __init__(self, source): super(MyStringEditor3, self).__init__(source) self.name.validate(lambda v: validator.to_string(v, strip=True).shorter_than(5, msg="test6 - Length must be shorter than %(max)d characters"))
def __init__(self, source): super(MyEditor, self).__init__(source, self.fields) self.name.validate(lambda v: validator.to_string(v, strip=True).not_empty().to_string()) self.age.validate(lambda v: validator.to_int(v).lesser_than(50).greater_than(0).to_int())
def __init__(self, source): super(MyStringEditor2, self).__init__(source) self.name.validate(lambda v: validator.to_string(v, strip=True).match(r'^[a-d]+$', msg="test5 - Incorrect format"))
def __init__(self, title, description, save_template_func): self.save_template_func = save_template_func self.title = editor.Property(title) self.title.validate(lambda v: nagare_validator.to_string(v).not_empty()) self.description = editor.Property(description) self.shared = editor.Property(False).validate(validator.BoolValidator)
def __init__(self, source): super(MyStringEditor5, self).__init__(source) self.name.validate( lambda v: validator.to_string(v, strip=True).longer_than( 5).shorter_or_equal_than(8).not_empty().match(r'^[1-9]+$'))
def __init__(self, source): super(MyStringEditor4, self).__init__(source) self.name.validate(lambda v: validator.to_string(v, strip=True).length_equal(5, msg="test7 - Length must be %(len)d characters"))
def __init__(self, source): super(MyStringEditor1, self).__init__(source) self.name.validate(lambda v: validator.to_string(v, strip=True).not_empty())