[SQLObject] Re: One time initialisation of attributes
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Brian B. <ex...@gm...> - 2005-02-14 10:39:34
|
Martin Clausen wrote: > class User(SQLObject): > > def _init(self, id, *args, **kw): > > SQLObject._init(self, id, *args, **kw) > self.uuid = UID() > self.password = encrypt(self.password) I think this particular case is simple enough for you to be able to use something like this (put this in your class definition, and ditch the _init method shown above): # Replace your uuid definition with this. # If no value is provided, UID() will be called. uuid = StringCol(length=32, default=UID) # Keep current password definition, add this. def _set_password(self, value): encrypted = encrypt(value) self._SO_set_password(encrypted) -- Brian Beck Adventurer of the First Order |