Skip to content

Commit efdb64a

Browse files
author
Richard Jones
committed
fixed retirement of items in rdbms imports [SF#841355]
fixed bug in looking up journal of newly-created items in *dbm backends
1 parent 1d9647b commit efdb64a

File tree

6 files changed

+26
-12
lines changed

6 files changed

+26
-12
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Fixed:
1111
- fixed javascript for help window for only one checkbox case
1212
- Date +/- Interval now works, and Date - Date also works
1313
- handle socket timeout exception (thanks Marcus Priesch)
14+
- fixed retirement of items in rdbms imports (sf bug 841355)
15+
- fixed bug in looking up journal of newly-created items in *dbm backends
1416

1517

1618
2003-09-29 0.6.2

roundup/backends/back_anydbm.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
#$Id: back_anydbm.py,v 1.122.2.1 2003-08-26 00:12:28 richard Exp $
18+
#$Id: back_anydbm.py,v 1.122.2.2 2003-11-14 00:19:01 richard Exp $
1919
'''
2020
This module defines a backend that saves the hyperdatabase in a database
2121
chosen by anydbm. It is guaranteed to always be available in python
@@ -508,7 +508,11 @@ def getjournal(self, classname, nodeid):
508508
if str(error) == "need 'c' or 'n' flag to open new db":
509509
raise IndexError, 'no such %s %s'%(classname, nodeid)
510510
elif error.args[0] != 2:
511+
# this isn't a "not found" error, be alarmed!
511512
raise
513+
if res:
514+
# we have unsaved journal entries, return them
515+
return res
512516
raise IndexError, 'no such %s %s'%(classname, nodeid)
513517
try:
514518
journal = marshal.loads(db[nodeid])
@@ -927,7 +931,7 @@ def export_list(self, propnames, nodeid):
927931
l.append(repr(value))
928932

929933
# append retired flag
930-
l.append(self.is_retired(nodeid))
934+
l.append(repr(self.is_retired(nodeid)))
931935

932936
return l
933937

roundup/backends/back_bsddb.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
#$Id: back_bsddb.py,v 1.26 2003-05-09 01:47:50 richard Exp $
18+
#$Id: back_bsddb.py,v 1.26.2.1 2003-11-14 00:19:01 richard Exp $
1919
'''
2020
This module defines a backend that saves the hyperdatabase in BSDDB.
2121
'''
@@ -105,7 +105,12 @@ def getjournal(self, classname, nodeid):
105105
db = bsddb.btopen(os.path.join(self.dir, 'journals.%s'%classname),
106106
'r')
107107
except bsddb.error, error:
108-
if error.args[0] != 2: raise
108+
if error.args[0] != 2:
109+
# this isn't a "not found" error, be alarmed!
110+
raise
111+
if res:
112+
# we have unsaved journal entries, return them
113+
return res
109114
raise IndexError, 'no such %s %s'%(classname, nodeid)
110115
# more handling of bad journals
111116
if not db.has_key(nodeid):

roundup/backends/back_bsddb3.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
#$Id: back_bsddb3.py,v 1.19 2003-05-09 01:47:50 richard Exp $
18+
#$Id: back_bsddb3.py,v 1.19.2.1 2003-11-14 00:19:02 richard Exp $
1919
'''
2020
This module defines a backend that saves the hyperdatabase in BSDDB3.
2121
'''
@@ -105,6 +105,9 @@ def getjournal(self, classname, nodeid):
105105
db = bsddb3.btopen(os.path.join(self.dir, 'journals.%s'%classname),
106106
'r')
107107
except bsddb3._db.DBNoSuchFileError:
108+
if res:
109+
# we have unsaved journal entries, return them
110+
return res
108111
raise IndexError, 'no such %s %s'%(classname, nodeid)
109112
# more handling of bad journals
110113
if not db.has_key(nodeid):

roundup/backends/back_metakit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: back_metakit.py,v 1.47.2.1 2003-08-26 00:12:28 richard Exp $
1+
# $Id: back_metakit.py,v 1.47.2.2 2003-11-14 00:19:02 richard Exp $
22
'''
33
Metakit backend for Roundup, originally by Gordon McMillan.
44
@@ -1178,7 +1178,7 @@ def export_list(self, propnames, nodeid):
11781178
l.append(repr(value))
11791179

11801180
# append retired flag
1181-
l.append(self.is_retired(nodeid))
1181+
l.append(repr(self.is_retired(nodeid)))
11821182

11831183
return l
11841184

roundup/backends/rdbms_common.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: rdbms_common.py,v 1.58.2.1 2003-08-26 00:12:28 richard Exp $
1+
# $Id: rdbms_common.py,v 1.58.2.2 2003-11-14 00:19:02 richard Exp $
22
''' Relational database (SQL) backend common code.
33
44
Basics:
@@ -1088,7 +1088,7 @@ def export_list(self, propnames, nodeid):
10881088
elif isinstance(proptype, hyperdb.Password):
10891089
value = str(value)
10901090
l.append(repr(value))
1091-
l.append(self.is_retired(nodeid))
1091+
l.append(repr(self.is_retired(nodeid)))
10921092
return l
10931093

10941094
def import_list(self, propnames, proplist):
@@ -1145,6 +1145,9 @@ def import_list(self, propnames, proplist):
11451145
if newid is None:
11461146
newid = self.db.newid(self.classname)
11471147

1148+
# add the node and journal
1149+
self.db.addnode(self.classname, newid, d)
1150+
11481151
# retire?
11491152
if retire:
11501153
# use the arg for __retired__ to cope with any odd database type
@@ -1155,9 +1158,6 @@ def import_list(self, propnames, proplist):
11551158
print >>hyperdb.DEBUG, 'retire', (self, sql, newid)
11561159
self.db.cursor.execute(sql, (1, newid))
11571160

1158-
# add the node and journal
1159-
self.db.addnode(self.classname, newid, d)
1160-
11611161
# extract the extraneous journalling gumpf and nuke it
11621162
if d.has_key('creator'):
11631163
creator = d['creator']

0 commit comments

Comments
 (0)