I've got the following auth_user table definition:

## add extra fields to auth_user table
auth.settings.extra_fields['auth_user']= [
  Field('username', length=32, default='', requires=[IS_LENGTH(32, 
error_message='Lengte overschreidt 32 tekens'), 
IS_NOT_EMPTY(error_message='Vul gebruikersnaam in'), IS_NOT_IN_DB(db, 
'auth_user.username', error_message='Gebruikersnaam al in database')], 
notnull=True, unique=True, label='Gebruikersnaam * ', writable=False, 
readable=False),
  Field('vertexID', 'reference vtx_vertex', 
requires=[IS_EMPTY_OR(IS_IN_DB(db, 'vtx_vertex.id', '%(id)s', 
zero='Selecteer een vertex'))], ondelete='CASCADE', label='VertexID * ', 
writable=False, readable=False)]


In a function which registers a user, I've got the following code:

if request.post_vars: # indicates a form submission
        if len(name) > 4:
            slice0 = name[:4]
        else:
            slice0 = name
        username = str(slice0) + str(now) + str(request.now.year)[2:]
        db.auth_user.username.default = username
        password = generate_password(name, now)
        pcrypt = lambda password: 
db.auth_user.password.requires[1](password)[0]
        db.auth_user.password.default = pcrypt(password)
        db.auth_user.vertexID.default = vertexID

form = SQLFORM.factory(db.auth_user, submit_button='Registreer')


In version 2.9 this worked, after upgrading to 2.10.4 this no longer works, 
I get the
following error:

Traceback (most recent call last):
  File "/Users/iannet/web2py_local/gluon/restricted.py", line 227, in 
restricted
    exec ccode in environment
  File 
"/Users/iannet/web2py_local/applications/my/controllers/register.py", line 
721, in <module>
  File "/Users/iannet/web2py_local/gluon/globals.py", line 393, in <lambda>
    self._caller = lambda f: f()
  File "/Users/iannet/web2py_local/gluon/tools.py", line 3440, in f
    return action(*a, **b)
  File "/Users/iannet/web2py_local/gluon/tools.py", line 3440, in f
    return action(*a, **b)
  File 
"/Users/iannet/web2py_local/applications/my/controllers/register.py", line 
312, in process_register_form
    db.auth_user.password.default = pcrypt(password)
  File 
"/Users/iannet/web2py_local/applications/my/controllers/register.py", line 
311, in <lambda>
    pcrypt = lambda password: db.auth_user.password.requires[1](password)[0]
IndexError: list index out of range


Variables db.auth_user.password.requires [<gluon.validators.CRYPT object>]  
global 
db <DAL uri="postgres:******@localhost:5432/leonexus_lc">  db.auth_user <Table 
auth_user 
(id,first_name,last_name,email,...set_password_key,registration_id,title,vertexID)>
  
pcrypt undefined  password 'AsseC|512'  db.auth_user.password 
<pydal.objects.Field 
object>

What change between web2py version causes this error, and how do I solve 
the issue?


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to