From: Martin d'A. <Mar...@s2...> - 2004-12-02 23:06:50
|
> > 1. caching of newly created objects (inserts) > > 2. Avoid issuing the subseqent select to initialize newly created > > objects (_init() calls selectOne()) > > > > Ryan Harper > > The purpose of SQLObject._init() seems to be the initialization of the > instance member values. To do that, it needs to fetch the data from the > database. But since this is called on object creation, the data should be > known without going to the database. > > Martin I have two solutions for this problem. 1) put an if around the whole tail end of SQLObject._init() and do not call self._SO_selectInit(selectResults) 2) if around the line: selectResults = self._connection._SO_selectOne(self, dbNames) and fill in the selectResults tuple from within the SQLObject.self (with getattr(self,dbName)) and still call self._SO_selectInit(selectResults) Is one solution preferable over the other? Should I set self.dirty = True? Thanks, Martin |