I'm working on a form to let the site administrator edit everything that's part of a user's record in the auth.user table. I want to be able to edit the registration key, reset passwords, etc. This code is almost working, except that when I want to only update the registration key, it also clobbers the password field instead of leaving it alone. I'm surprised, because I expected that if 'password' wasn't defined in the dictionary, that no update would happen to that field.
Here is how my password field is defined in db.py: db.Field('password', 'password', readable=False, label='Password', requires=[IS_NOT_EMPTY(),CRYPT()]), This is the controller code that defines the form and tries to let the administrator leave the password unchanged by leaving the password field blank: form=SQLFORM (auth.settings.table_user,user_id,ignore_rw=True,deletable=True) if 'password' in request.vars and request.vars['password'] == '' and \ IS_NOT_EMPTY in map(type,form.table['password'].requires): for r in form.table['password'].requires: if type(r) == IS_NOT_EMPTY: original_is_not_empty_object = r form.table['password'].requires.remove(r) del request.vars['password'] else: original_is_not_empty_object = None if form.accepts(request.vars, session, keepvalues=True): response.flash=T("Form accepted input") if original_is_not_empty_object: form.table['password'].requires.append (original_is_not_empty_object) request.vars.clear() elif form.errors: response.flash=T("Oops, form is invalid.") ---- I'm running on GAE, btw - would that handle record updates differently? And do I need to replace the IS_NOT_EMPTY() after removing it? thanks Dan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---