def __init__(self, handler=None, obj=None, prefix='', formdata=None, **kwargs): if handler: formdata = MultiValueDict() for name in handler.request.arguments.keys(): formdata.setlist(name, handler.get_arguments(name)) Form.__init__(self, formdata, obj=obj, prefix=prefix, **kwargs)
def __init__(self,handler=None,obj=None,prefix='',**kwargs): if handler is None: return formdata = MultiDict() if handler.request.method == 'POST': for name in handler.request.arguments.keys(): formdata.setlist(name,handler.get_arguments(name)) else: for name in handler.request.query_arguments.keys(): formdata.setlist(name,handler.request.query_arguments[name]) Form.__init__(self,formdata,obj=obj,prefix=prefix,**kwargs) #class LoginForm(BaseForm): pass
def test_automatic_wrapping(self): def _check(formdata): self.assertTrue(isinstance(formdata, TornadoInputWrapper)) form = Form({'a': SneakyField(_check)}) form.process(self.filled_mdict)
def validate(self): if not Form.validate(self): return False return User.authenticate(email=self.data['email'], password=self.data['password'])