that is because you have an old version of web2py.

On Aug 12, 12:19 pm, drayco <antrod...@gmail.com> wrote:
> Inhttp://web2py.com/book/default/chapter/08#Authenticationand
> Customizing Auth
>
> Example:
>
> # after
> # auth = Auth(globals(),db)
>
> db.define_table(
>     auth.settings.table_user_name,
>     Field('first_name', length=128, default=''),
>     Field('last_name', length=128, default=''),
>     Field('email', length=128, default='', unique=True),
>     Field('password', 'password', length=512,
>           readable=False, label='Password'),
>     Field('registration_key', length=512,
>           writable=False, readable=False, default=''),
>     Field('reset_password_key', length=512,
>           writable=False, readable=False, default=''),
>     Field('registration_id', length=512,
>           writable=False, readable=False, default=''))
>
> auth_table.first_name.requires = \
>   IS_NOT_EMPTY(error_message=auth.messages.is_empty)
> auth_table.last_name.requires = \
>   IS_NOT_EMPTY(error_message=auth.messages.is_empty)
> auth_table.password.requires = [IS_STRONG(), CRYPT()]
> auth_table.email.requires = [
>   IS_EMAIL(error_message=auth.messages.invalid_email),
>   IS_NOT_IN_DB(db, auth_table.email)]
> auth.settings.table_user = auth_table
>
> # before
> # auth.define_tables()
>
> It didn't work. I followed a discussion and if I want that work, We
> need this:
>
> auth_table = db.define_table(
>     auth.settings.table_user_name,
>     Field('created', 'datetime', default=request.now, writable=False,
> readable=False),
>     Field('first_name', length=128, default='', label='Nombre(s)'),
>     Field('last_name', length=128, default='', label='Apellido
> Paterno'),
>     Field('end_name', length=128, default='', label='Apellido
> Materno'),
>     Field('email', length=128, default='', unique=True, label='Correo
> electronico'),
>     Field('password', 'password', length=512, readable=False,
> label='Contraseña'),
>     Field('registration_key', length=512, writable=False,
> readable=False, default=''),
>     Field('reset_password_key', length=512, writable=False,
> readable=False, default=''),
>     Field('registration_id', length=512, writable=False,
> readable=False, default=''),
>     Field('rfc', 'string', label='RFC'),
>     Field('domicilio','string', label='Calle y Num.Ext., Num.Int.'),
>     Field('colonia','string'),
>     Field('municipio','string', label='Municipio ó Delegación'),
>     Field('estado','string', label='Estado'),
>     Field('cp','integer', label='C.P.'),
>     Field('tel', 'double', label='Tel. Casa'),
>     Field('cel', 'double', label='Tel. Celular', comment='Sin el
> 044'),
>     Field('sexo','string',
> requires=IS_IN_SET(['Masculuno','Femenino'])),
>
> Field('last_login','datetime',default=request.now,writable=False,readable=False),
>
> Field('last_ip',default=request.env.remote_addr,writable=False,readable=False))
>
> auth_table.first_name.requires =
> [IS_NOT_EMPTY(error_message=auth.messages.is_empty), IS_UPPER()]
> auth_table.last_name.requires =
> [IS_NOT_EMPTY(error_message=auth.messages.is_empty), IS_UPPER()]
> auth_table.end_name.requires =
> [IS_NOT_EMPTY(error_message=auth.messages.is_empty), IS_UPPER()]
> auth_table.email.requires =
> [IS_EMAIL(error_message=auth.messages.invalid_email), IS_NOT_IN_DB(db,
> auth_table.email)]
> auth_table.password.requires = [IS_STRONG(), CRYPT()]
> auth_table.rfc.requires = [IS_UPPER(),
> IS_NOT_EMPTY(error_message=auth.messages.is_empty), \
>                            IS_LENGTH(minsize=13,error_message='El
> tamaño debe ser de 13 caracteres'), \
>
> IS_NOT_IN_DB(db,auth_table.rfc,error_message='El RFC ya existe')]
> auth_table.domicilio.requires = [IS_NOT_EMPTY(error_message='No puede
> estar vacio'),IS_UPPER()]
> auth_table.colonia.requires=[IS_NOT_EMPTY(error_message='No puede
> estar vacio'),IS_UPPER()]
> auth_table.municipio.requires=[IS_NOT_EMPTY(error_message='No puede
> estar vacio'),IS_UPPER()]
> auth_table.estado.requires=[IS_NOT_EMPTY(error_message='No puede estar
> vacio'),IS_UPPER()]
> auth_table.cp.requires =
> [IS_NOT_EMPTY(error_message=auth.messages.is_empty), \
>                           IS_INT_IN_RANGE(0,1e100,error_message='Debe
> ser Numero positivo')]
> auth_table.tel.requires =
> [IS_NOT_EMPTY(error_message=auth.messages.is_empty), \
>
> IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero positivo')]
> auth_table.cel.requires =
> [IS_NOT_EMPTY(error_message=auth.messages.is_empty), \
>
> IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero positivo')]
> auth_table.sexo.requires = IS_IN_SET(['femenino','masculino'])
> auth.settings.table_user = auth_table
>
> It's only a litle typo.
> Well I show my customizing.

Reply via email to