[ZODB-Dev] question
Christian Reis
kiko at async.com.br
Wed Sep 10 16:16:18 EDT 2003
On Wed, Sep 10, 2003 at 02:12:10PM -0400, Shane Hathaway wrote:
> Christian Reis wrote:
> >On Wed, Sep 10, 2003 at 11:13:06AM -0400, Shane Hathaway wrote:
> >>I'm suggesting that when you open a dialog, you make a temporary copy
> >>of the data. That's not a hack--it's a standard object-oriented clone
> >>operation. Implement "cancel" by discarding the copy and "ok" by
> >>putting the new data in the database. It adds very little code and
> >>might even simplify things.
> >
> >
> >The problem that results from this is that this object may be a
> >composite object, and have references to other objects that need to be
> >accessible in the clone, so creating the clone itself is not trivial.
> >
> >Would the clone be produced using simple __dict__ introspection? Or
> >something like __new__?
>
> Use a trivial deep copy. (Although copy.deepcopy() doesn't like
> ExtensionClass, so if you're using ZODB 3.2 or below, you need to use
> cPickle to make the deep copy. I can show you how if you're need it.)
Please do, that's something I've often wondered about.
> Splitting up transactions would open major holes. You'd need something
> quite unlike ZODB to get it right. Making temporary copies is much
> simpler.
Okay, okay -- if only because you said so ;-)
Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
More information about the ZODB-Dev
mailing list