dabo Commit
Revision 5411
Date: 2009-09-22 20:45:59 -0700 (Tue, 22 Sep 2009)
Author: Paul
Trac: http://trac.dabodev.com/changeset/5411
Changed:
U trunk/dabo/db/dCursorMixin.py
Log:
As I'm not prepared to support all the dict functions like iteritems() and
has_key(), etc., I'm reverting the CursorRecord to inherit from object
again. However, just the existence of __getitem__() is enough to convince
the string formatter to work.
Diff:
Modified: trunk/dabo/db/dCursorMixin.py
===================================================================
--- trunk/dabo/db/dCursorMixin.py 2009-09-22 23:19:36 UTC (rev 5410)
+++ trunk/dabo/db/dCursorMixin.py 2009-09-23 03:45:59 UTC (rev 5411)
@@ -786,16 +786,18 @@
return ret
- def getPK(self):
- """ Returns the value of the PK field in the current record. If
that record
- is a new unsaved record, return the temp PK value. If this is a
compound
- PK, return a tuple containing each field's values.
+ def getPK(self, row=None):
+ """ Returns the value of the PK field in the current or passed
record number.
+ If that record is a new unsaved record, return the temp PK
value. If this is a
+ compound PK, return a tuple containing each field's values.
"""
- ret = None
if self.RowCount <= 0:
raise dException.NoRecordsException(
_("No records in the data set."))
- rec = self._records[self.RowNumber]
+ ret = None
+ if row is None:
+ row = self.RowNumber
+ rec = self._records[row]
recKey = self.pkExpression(rec)
if (recKey in self._newRecords) and self.AutoPopulatePK:
# New, unsaved record
@@ -1427,7 +1429,7 @@
rec = self._records[row]
try:
- pk = self.getPK()
+ pk = self.getPK(row)
del self._mementos[pk]
except KeyError:
# didn't exist
@@ -1451,7 +1453,7 @@
rec = self._records[row]
try:
- pk = self.getPK()
+ pk = self.getPK(row)
del self._newRecords[pk]
except KeyError:
# didn't exist
@@ -2528,7 +2530,7 @@
try:
ret = self._cursorRecord
except AttributeError:
- class CursorRecord(dict):
+ class CursorRecord(object):
def __init__(self):
self.cursor = None
super(CursorRecord, self).__init__()
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/[email protected]