[ZODB-Dev] Re: false write conflicts

John Belmonte john at neggie.net
Tue Mar 2 12:37:30 EST 2004


Tim Peters wrote:
>>class MyPersistent(Persistent):
>>  def __setattr__(self, key, val):
>>    if not (self.__dict__.has_key(key) and self.__dict__[key] is val):
>>      Persistent.__setattr__(self, key, val)
> 
> 
> That looks safe to me.  Note that there's no guarantee that, e.g., in
> 
>    foo.bar += 0
> 
> you won't end up calling Persistent.__setattr__() anyway (immutable objects
> generally don't promise to reuse self whenever semantically possible).

That's fine, and the wrapper behaves correctly.  In reality, I'm the one 
implementing all augmented operations on database objects, incorporating 
conflict resolution.

-John

-- 
http:// if  ile.org/



More information about the ZODB-Dev mailing list