On Thu, Mar 04, 2004 at 05:24:38PM -0600, Ian Bicking wrote:
> You shouldn't keep the SQLObject instances in the session -- they
> persist independently in the database, and it can potentially confuse
> things if you keep them elsewhere. Well... maybe not so much. Really
> they should be pickleable (only they aren't).
> I think you could add a method to your classes:
> def __getinitargs__(self):
> return (self.id,)
> then SQLObject instances would be pickleable. But I haven't tried it.
> This is assuming you aren't using transactions, which would complicate
> things considerably, and using transactions with sessions like this
> would generally require more thought all around.
I guess my english cause me a issue. In fact i don't want to make
SQLObject persist in session. I want to edit/modify a FakeSQLObjet and
when all is ok, i will save it back into DB.(just by changing the
when i want to edit a SQLobject, I just clone it into a real object
with something like copying attributes.. working on this object in
session, and when everything is ok. I change do the same changes to
the real SLQobject. But this doesn't work really well since my 'clone'
method produce some un-pickable objects. So i guess there is a
standard method to do this easily ..
In a previous life, i used Modeling for a while, and in Modeling
you simply work in a editing context and binding an ec to session
is easy so, commiting changes is just a ec.saveChanges()... and
to loose modification simply discard this ec. Despite this introduce
a lot of issues, it's really pretty for this kind of stuff.
Perhaps i can do the same w/ transaction in SQLObject ?
Bye Bye ..