[SQLObject] cacheValues, destroySelf, etc
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Luke O. <lu...@me...> - 2003-05-09 00:59:47
|
Hi all - Ok, I've finally had some time to put towards SQLObject-based Transactions (backend-independent), as a test implementation. I'm doing it with an in-memory connection class that is swapped for the real object's connection, and then replaced. Seems to be working pretty well. But I'm having a few unrelated issues that are getting in the way of finalizing this. This is all based on CVS from a week or so ago, but for some reason I can't get latest CVS to try on right now. 1. cacheValues. Now that I'm poking around with modifying objects, I'm encountering Frank Barknecht's problem with cacheValues and modified attributes not displaying. This is independent of whether I have a real object or one of my temp ones. The problem is immediately with this line of code in _SO_setValue: if cls._SO_autoInitDone: setattr(self, instanceName(name), value) because _SO_autoInitDone is never (anywhere in SQLObject.py) set to true. Now, I can't tell if this is just a missing line somewhere, or if autoInitDone is an old flag that doesn't have any meaning now that we're using _SO_selectInit. Ian? For now, my best-guess solution has been to replace the few instances of _SO_autoInitDone with _cacheValues where appropriate, to mirror the setup in addColumn. Seems to be working so far... 2. Is there a good reason SQLObject.destroy(self) was renamed to SQLObject.destroySelf(self)? It just doesn't read correctly to me, and breaks some other code we have, and.. I just don't get it. Unless the intention was to eventually have a cascading delete on the python side. (we just enforce such things through Postgres, but maybe there's a case for a having it on the python side.) In which case I'd still argue to leave .destroy() as the default (since cascade may be enforced on the db side), and either have an argument 'cascade', or a separate method .destroyRelated() or similar. I've changed it back to .destroy() in my copies until I hear otherwise. :) Ok, that's all, a little more testing, integrate this into latest CVS version, and i'll throw it at you. - Luke -- i find your contempt for naked feet curious. |