import colander import deform from . import CSRFSchema from .helpers import ( deferred_unique_email_validator, deferred_unique_username_validator, ) # schema for user registration class RegistrationSchema(CSRFSchema): ''' new user registration ''' username = colander.SchemaNode( colander.String(), widget=deform.widget.TextInputWidget( readonly=True, ), description='automagically generated for you', validator=deferred_unique_username_validator, ) first_name = colander.SchemaNode( colander.String() ) last_name = colander.SchemaNode( colander.String() ) email = colander.SchemaNode( colander.String(), validator=deferred_unique_email_validator ) password = colander.SchemaNode( colander.String(), widget=deform.widget.CheckedPasswordWidget() )