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.
-- 
     Oleg Broytmann            http://phd.pp.ru/            [EMAIL PROTECTED]
           Programmers don't die, they just GOSUB without RETURN.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to