PAGE Form validator - ukážka @expose(template="gs.templates.someform") @validate(validators = { "item": validators.PlainText(), # iba text "size": validators.OneOf(['S','M','L'], if_empty="M"), # konkrétne hodnoty "price": validators.Money(not_empty=True) # vyžadované }) def storeitem(self, tg_errors=None, **kwargs): if tg_errors: message = [str(item) for item in tg_errors.values()] message = ', '.join(message) return dict(message=message) else: return dict(message="Success!")
PREVIOUS NEXT