[TransWarp] Small Patch for DataModel.py
Holger Brückner
lists at net-labs.de
Wed May 29 16:55:30 EDT 2002
Hello,
playing around with ulrich to integrate our transaction manager into tw
i found some typing errors in DataModel.py
also it seams like del ensureRegistered might be called more than once
with will result in an not very meaningfull "Record has no attribute
ensureRegistered error". so i wrapped the del lines so that they first
check if the attribute is in __dict__.
cya
Holger
-------------- next part --------------
--- DataModel.py Wed May 29 21:58:11 2002
+++ DataModel_fixed.py Wed May 29 21:02:53 2002
@@ -130,23 +130,25 @@
def commit(self, record, transaction):
if record.dirtyFields: record.flushWrites()
self.committedRecords.append(record)
- del record.ensureRegistered
+ if record.__dict__.has_key('ensureRegistered'):
+ del record.ensureRegistered
def abort(self, record, transaction):
record.invalidate()
- del record.ensureRegistered
+ if record.__dict__.has_key('ensureRegistered'):
+ del record.ensureRegistered
def tpc_vote(self, transaction):
"""Last chance to raise an error - no-op by default"""
def tpc_abort(self, transaction):
- for record in self.commitedRecords:
+ for record in self.committedRecords:
record.invalidate()
- self.commitedRecords = []
+ self.committedRecords = []
def tpc_finish(self, transaction):
"""Can be overridden to do post-commit operations"""
- self.commitedRecords = []
+ self.committedRecords = []
@@ -225,7 +227,8 @@
def flushWrites(self):
self.recordManager._saveRecord(self)
assert len(self.dirtyFields)==0, "Unsaved fields!"
- del self.ensureQueued # error if flush called when not queued!
+ if self.__dict__.has_key('ensureQueued'):
+ del self.ensureQueued # error if flush called when not queued!
def loadDefaults(self, items):
More information about the PEAK
mailing list