You can add something like this to your user class:

def set_pasword(self, cleartext_pw):
    "Saves a password using encryption rule stated in identity config."
    self.password =
identity.current_provider.encrypt_password(cleartext_pw)

That's not quite as clean as the SqlObject way, but I'm not sure how
you get to the real column if you were to override the name 'password'
in the class.  Someone more knowledagable about sqlalchemy will need to
respond if that is possible.

Also, the above assumes that identity is running, so you wouldn't be
able to use that model in an outside project, or even in the tg-admin
shell.  You might want to use a try/except block and do something else
if that is a requirement.  (See how encrypt_password in
http://trac.turbogears.org/turbogears/browser/branches/1.0/turbogears/identity/soprovider.py
is implemented for some guidance).


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to