[ZODB-Dev] question
Shane Hathaway
shane at zope.com
Wed Sep 10 15:12:10 EDT 2003
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.)
Splitting up transactions would open major holes. You'd need something
quite unlike ZODB to get it right. Making temporary copies is much simpler.
Shane
More information about the ZODB-Dev
mailing list