Re: [SQLObject] cacheValues, destroySelf, etc
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Ian B. <ia...@co...> - 2003-05-09 02:23:28
|
On Thu, 2003-05-08 at 15:42, Luke Opperman wrote: > 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... Yes, that was obsolete code hanging around and causing problems, and I took it out of CVS a couple days ago. > 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 been planning for destroySelf to delete rows from RelatedJoins, but further cascading is up in the air. Maybe the join objects could indicate how cascading should work (so it would be in the class definition, not in the method invocation). But that wasn't really the reason for the change. I added a "delete" class method, and delete and destroy are like two ways of saying the same thing. Plus I don't like the destroy method (whatever its name), and I was thinking of taking it out (in favor of the delete class method). Self-destructing objects are weird, and they don't fit the Python model... though at some level that has to happen because the underlying databases aren't like Python (with garbage collecting, etc). I.e., instances have to become obsolete even before they are garbage collected. Maybe selfDestruct() would be a better name :) Ian |