<s> import solution as f <EOL> from solution import validators as v <EOL> from . models import auth , User <EOL> class UsernameDoesNotExist ( v . Validator ) : <EOL> code = '<STR_LIT>' <EOL> message = u'<STR_LIT>' <EOL> def __call__ ( self , python_value = None , form = None ) : <EOL> return not User . by_login ( python_value ) <EOL> class RegisterForm ( f . Form ) : <EOL> _model = User <EOL> login = f . Text ( validate = [ <EOL> v . Required , <EOL> v . LongerThan ( <NUM_LIT:4> ) , <EOL> UsernameDoesNotExist , <EOL> ] ) <EOL> email = f . Text ( validate = [ v . ValidEmail ] ) <EOL> password = f . Text ( <EOL> hidden = True , <EOL> validate = [ <EOL> v . Required , <EOL> v . LongerThan ( auth . password_minlen ) , <EOL> v . ShorterThan ( auth . password_maxlen ) <EOL> ] <EOL> ) </s>
