Skip to content

Commit 5d53f6e

Browse files
author
Alexander Smishlajev
committed
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: []
1 parent d3582d0 commit 5d53f6e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

roundup/backends/rdbms_common.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: rdbms_common.py,v 1.130 2004-09-26 14:16:06 a1s Exp $
1+
# $Id: rdbms_common.py,v 1.131 2004-09-26 14:38:54 a1s Exp $
22
''' Relational database (SQL) backend common code.
33
44
Basics:
@@ -46,6 +46,9 @@
4646
# number of rows to keep in memory
4747
ROW_CACHE_SIZE = 100
4848

49+
# dummy value meaning "argument not passed"
50+
_marker = []
51+
4952
def _num_cvt(num):
5053
num = str(num)
5154
try:
@@ -1394,7 +1397,6 @@ def create_inner(self, **propvalues):
13941397
# XXX numeric ids
13951398
return str(newid)
13961399

1397-
_marker = []
13981400
def get(self, nodeid, propname, default=_marker, cache=1):
13991401
'''Get the value of a property on an existing node of this class.
14001402
@@ -1437,7 +1439,7 @@ def get(self, nodeid, propname, default=_marker, cache=1):
14371439
# XXX may it be that propname is valid property name
14381440
# (above error is not raised) and not d.has_key(propname)???
14391441
if (not d.has_key(propname)) or (d[propname] is None):
1440-
if default is self._marker:
1442+
if default is _marker:
14411443
if isinstance(prop, Multilink):
14421444
return []
14431445
else:
@@ -2523,7 +2525,6 @@ def create(self, **propvalues):
25232525
self.db.storefile(self.classname, newid, None, content)
25242526
return newid
25252527

2526-
_marker = []
25272528
def get(self, nodeid, propname, default=_marker, cache=1):
25282529
''' Trap the content propname and get it from the file
25292530
@@ -2537,7 +2538,7 @@ def get(self, nodeid, propname, default=_marker, cache=1):
25372538
# BUG: by catching this we donot see an error in the log.
25382539
return 'ERROR reading file: %s%s\n%s\n%s'%(
25392540
self.classname, nodeid, poss_msg, strerror)
2540-
if default is not self._marker:
2541+
if default is not _marker:
25412542
return Class.get(self, nodeid, propname, default)
25422543
else:
25432544
return Class.get(self, nodeid, propname)
@@ -2624,3 +2625,4 @@ def __init__(self, db, classname, **properties):
26242625
properties['superseder'] = hyperdb.Multilink(classname)
26252626
Class.__init__(self, db, classname, **properties)
26262627

2628+
# vim: set et sts=4 sw=4 :

0 commit comments

Comments
 (0)