thank you for responding.
my error is editing the code in the posting (which I tell myself I should
never do!)
I actually have:
users[0].update_record({'registration_key'' : ''})

but even that is crazy talk and you are right, the following is correct...
users[0].update_record(registration_key='')

thanks for your help. I just couldn't see the problem for want of staring.


On 29 October 2010 17:20, villas <villa...@gmail.com> wrote:

> This doesn't look very well formed:
> users[0].update_record({'registration_key''})
>
> See the manual example...
>
> >>>rows=db(db.person.id>2).select()
> >>>row=rows[0]
> >>>row.update_record(name='Curt')
>
> http://www.web2py.com/book/default/chapter/06?search=update_record
>
> -D
>
>
> On Oct 29, 3:32 pm, Carl <carl.ro...@gmail.com> wrote:
> > When I try and do an update_record() I get an exception.
> > Is there something wrong with my table definition?
> > Can anyone help?
> >
> > From db.py:
> > auth.settings.table_user = db.define_table(
> >     auth.settings.table_user_name,
> >     db.Field('email', 'string', length=254, unique=True, notnull=True,
> > required=True, requires = [IS_LOWER(), IS_EMAIL(),
> > IS_NOT_IN_DB(db,'%s.email'%auth.settings.table_user_name)]),
> >     db.Field('password', 'password', length=512, readable=False,
> > label='Password', requires = [CRYPT(key='***')]),
> >     db.Field('registration_id', length=512, writable=False,
> > readable=False, default=''),
> >     db.Field('registration_key', length=512, writable=False,
> > readable=False, default=''),
> >     db.Field('first_name', 'string', length=128),
> >     db.Field('last_name', 'string', length=128))
> >
> > The rest is in default.py:
> > registerAgent(form)
> > def registerLinkedInAgent():
> >     if auth.user.registration_key and
> > len(auth.user.registration_key):
> >         # one-off calls
> >         auth.add_membership(auth.id_group( 'agent'), auth.user.id)
> >
> >         # find current user's record and update registration key to an
> > empty string so this code isn't called again
> >         users =
> > db(db.auth_user.id==auth.user.id).select(db.auth_user.ALL)
> >         if users and len(users):
> >             users[0].update_record({'registration_key''})
> >     redirect(URL('account'))
> >
> > The problem is I get "ValueError: need more than 1 value to unpack"
> > when I call update_record()
> > Full trackback is below:
> > Traceback (most recent call last):
> >   File "E:\projects\workspace\TestEnvoy\web2py\gluon\restricted.py",
> > line 188, in restricted
> >     exec ccode in environment
> >   File "E:/projects/workspace/TestEnvoy/web2py/applications/init/
> > controllers/default.py", line 1528, in <module>
> >   File "E:\projects\workspace\TestEnvoy\web2py\gluon\globals.py", line
> > 96, in <lambda>
> >     self._caller = lambda f: f()
> >   File "E:/projects/workspace/TestEnvoy/web2py/applications/init/
> > controllers/default.py", line 1132, in registerLinkedInAgent
> >     users[0].update_record({'registration_key' : ''})
> >   File "E:\projects\workspace\TestEnvoy\web2py\gluon\sql.py", line
> > 3381, in <lambda>
> >     colset.update_record = lambda _ = (colset, table, id), **a:
> > update_record(_, a)
> >   File "E:\projects\workspace\TestEnvoy\web2py\gluon\sql.py", line
> > 3508, in update_record
> >     (colset, table, id) = pack
> > ValueError: need more than 1 value to unpack

Reply via email to