Re: [SQLObject] Storing password hashes using built-in functions like PASSWORD() (where available)
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Florian H. <fl...@li...> - 2008-09-04 11:32:20
|
Oleg, precisely what I was looking for. Thank you very much! Cheers, Florian Oleg Broytmann wrote: > On Thu, Sep 04, 2008 at 12:38:02PM +0200, Florian Haas wrote: >> def _set_password(self, newpass): >> try: >> # FIXME: update field with hash generated >> # from PASSWORD(newpass) > > The problem with this approach is that when you set (UPDATE) an > attribute (SQL field) SQLObject caches the values so it doesn't need to ask > SQL every time. Unfortunately when you set an attribute using SQL function, > there is no value to cache. You have to turn off SQLObject caching for the > class (table). > This example works for me: > > class Test(SQLObject): > class sqlmeta: > cacheValues = False > s = StringCol() > > Test.createTable() > > t = Test(s='') > t.s = func.upper('oops!') > print t.s > > and prints "OOPS!". But remember - with caching turned off SQLObject > issues a separate SELECT for every attribute access. > > Oleg. |