Here, Voltron - see if this makes more sense:

On Tue, Nov 25, 2008 at 12:01 AM, mdipierro <[EMAIL PROTECTED]> wrote:

>
>            id=db.users.update(
>                               email        = form.vars.email,
>                               password     = form.vars.password
>                               )
>
> should be
>

(I'll try to correct what Massimo suggested:)

            row = db(db.users.email == form.vars.email).select()
            row.update_record(

>                                email        = form.vars.new_email,
>                               password     = form.vars.password
>                               )
>

Of course, assuming new_email is wanted, and validated... you can work that
out :-)


>
> else you are updating the db.users dictionary thus redefining the
> meaning of field email and field password.


> Massimo


Above, Massimo makes an important point (I've been having a private
discussion w/ him about the way this is all named, currently wrapped in
classes, etc.).

Hope that helps.

Regards,
Yarko


>
>
> On Nov 24, 11:18 pm, voltron <[EMAIL PROTECTED]> wrote:
> > I am using:
> >
> > Version 1.51 (2008-11-19 14:48:02)
> > Database drivers available: SQLite3, Postgre
> >
> > The only code that could be of use is this snippet, the rest are
> > several lines of forms, strings, mail templates and such
> >
> > user = db(db.users.id == session.user_id).select()
> >
> > if form.accepts(request.vars,session,
> > formname="account_management_form") and
> > form.vars.password==form.vars.password2:
> >         key = md5.new(str(random.randint(0,9999))).hexdigest()
> >         try:
> >             id=db.users.update(
> >                                email        = form.vars.email,
> >                                password     = form.vars.password
> >                                )
> >
> >         except Exception, detail:
> >             print 'Error:', detail
> >             response.flash = T("Update unsuccessful, please contact
> > our service team")
> >         else:
> >             db.commit()
> >             session.flash = user[0].user_name
> >             redirect(URL(r=request, f="manage_account"))
> >     elif form.vars.password != form.vars.password2:
> >         form.errors.password2 = T('Passwords do not match')
> >         response.flash = T("Update unsuccessful, please contact our
> > service team")
> >     elif form.errors:
> >         response.flash = T("Please check your values")
> >     else:
> >         pass
> >         #response.flash = T("Please fill in the registration form")
> >
> >     return dict(form = form, page_title = page_title, page_content =
> > page_content)
> >
> > Thanks
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to