diff roundup/backends/rdbms_common.py @ 2692:f1c9873496f0

fix Class.get(): it was relying on self._marker... ...and that value was different for FileClass instances. the _marker is moved to module globals. fixes error in test testImportExport: TypeError: new property "comment" not a string: []
author Alexander Smishlajev <a1s@users.sourceforge.net>
date Sun, 26 Sep 2004 14:38:54 +0000
parents 4008af78746a
children 15d945dff53d
line wrap: on
line diff
--- a/roundup/backends/rdbms_common.py	Sun Sep 26 14:16:06 2004 +0000
+++ b/roundup/backends/rdbms_common.py	Sun Sep 26 14:38:54 2004 +0000
@@ -1,4 +1,4 @@
-# $Id: rdbms_common.py,v 1.130 2004-09-26 14:16:06 a1s Exp $
+# $Id: rdbms_common.py,v 1.131 2004-09-26 14:38:54 a1s Exp $
 ''' Relational database (SQL) backend common code.
 
 Basics:
@@ -46,6 +46,9 @@
 # number of rows to keep in memory
 ROW_CACHE_SIZE = 100
 
+# dummy value meaning "argument not passed"
+_marker = []
+
 def _num_cvt(num):
     num = str(num)
     try:
@@ -1394,7 +1397,6 @@
         # XXX numeric ids
         return str(newid)
 
-    _marker = []
     def get(self, nodeid, propname, default=_marker, cache=1):
         '''Get the value of a property on an existing node of this class.
 
@@ -1437,7 +1439,7 @@
         # XXX may it be that propname is valid property name
         #    (above error is not raised) and not d.has_key(propname)???
         if (not d.has_key(propname)) or (d[propname] is None):
-            if default is self._marker:
+            if default is _marker:
                 if isinstance(prop, Multilink):
                     return []
                 else:
@@ -2523,7 +2525,6 @@
         self.db.storefile(self.classname, newid, None, content)
         return newid
 
-    _marker = []
     def get(self, nodeid, propname, default=_marker, cache=1):
         ''' Trap the content propname and get it from the file
 
@@ -2537,7 +2538,7 @@
                 # BUG: by catching this we donot see an error in the log.
                 return 'ERROR reading file: %s%s\n%s\n%s'%(
                         self.classname, nodeid, poss_msg, strerror)
-        if default is not self._marker:
+        if default is not _marker:
             return Class.get(self, nodeid, propname, default)
         else:
             return Class.get(self, nodeid, propname)
@@ -2624,3 +2625,4 @@
             properties['superseder'] = hyperdb.Multilink(classname)
         Class.__init__(self, db, classname, **properties)
 
+# vim: set et sts=4 sw=4 :

Roundup Issue Tracker: http://roundup-tracker.org/