Skip to content

Commit 92a6ece

Browse files
author
Richard Jones
committed
merge from HEAD
1 parent bb8af5f commit 92a6ece

File tree

4 files changed

+24
-9
lines changed

4 files changed

+24
-9
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Fixed:
77
- mailgw handler can close the database on us
88
- fixed grouping by a NULL Link value
99
- fixed anydbm import/export (sf bugs 965216, 964457, 964450)
10+
- fix python 2.3.3 strftime deprecation warning (sf patch 968398)
1011

1112

1213
2004-05-28 0.7.3

roundup/backends/back_metakit.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: back_metakit.py,v 1.70.2.2 2004-05-23 23:26:29 richard Exp $
1+
# $Id: back_metakit.py,v 1.70.2.3 2004-06-08 05:34:21 richard Exp $
22
'''Metakit backend for Roundup, originally by Gordon McMillan.
33
44
Known Current Bugs:
@@ -209,8 +209,8 @@ def addjournal(self, tablenm, nodeid, action, params, creator=None,
209209
nodeid=int(nodeid),
210210
date=creation,
211211
action=action,
212-
user = creator,
213-
params = marshal.dumps(params))
212+
user=creator,
213+
params=marshal.dumps(params))
214214

215215
def setjournal(self, tablenm, nodeid, journal):
216216
'''Set the journal to the "journal" list.'''
@@ -223,7 +223,7 @@ def setjournal(self, tablenm, nodeid, journal):
223223
nodeid=int(nodeid),
224224
date=date,
225225
action=action,
226-
user=user,
226+
user=int(user),
227227
params=marshal.dumps(params))
228228

229229
def getjournal(self, tablenm, nodeid):
@@ -361,6 +361,15 @@ def numfiles(self):
361361
_UNLINK : 'unlink',
362362
}
363363

364+
_names_to_actionnames = {
365+
'create': _CREATE,
366+
'set': _SET,
367+
'retire': _RETIRE,
368+
'restore': _RESTORE,
369+
'link': _LINK,
370+
'unlink': _UNLINK,
371+
}
372+
364373
_marker = []
365374

366375
_ALLOWSETTINGPRIVATEPROPS = 0
@@ -1700,7 +1709,8 @@ def import_journals(self, entries):
17001709
d = {}
17011710
for l in entries:
17021711
l = map(eval, l)
1703-
nodeid, date, user, action, params = l
1712+
nodeid, jdate, user, action, params = l
1713+
jdate = int(calendar.timegm(date.Date(jdate).get_tuple()))
17041714
r = d.setdefault(nodeid, [])
17051715
if action == 'set':
17061716
for propname, value in params.items():
@@ -1716,7 +1726,8 @@ def import_journals(self, entries):
17161726
pwd.unpack(value)
17171727
value = pwd
17181728
params[propname] = value
1719-
r.append((nodeid, date.Date(date), user, action, params))
1729+
action = _names_to_actionnames[action]
1730+
r.append((nodeid, jdate, user, action, params))
17201731

17211732
for nodeid, l in d.items():
17221733
self.db.setjournal(self.classname, nodeid, l)

roundup/date.py

Lines changed: 2 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: date.py,v 1.68 2004-05-06 02:35:46 richard Exp $
18+
# $Id: date.py,v 1.68.2.1 2004-06-08 05:39:37 richard Exp $
1919

2020
"""Date, time and time interval handling.
2121
"""
@@ -349,7 +349,7 @@ def pretty(self, format='%d %B %Y'):
349349
format, then the day number will be removed from output.
350350
'''
351351
str = time.strftime(format, (self.year, self.month, self.day,
352-
self.hour, self.minute, self.second, 0, 0, 0))
352+
self.hour, self.minute, int(self.second), 0, 0, 0))
353353
# handle zero day by removing it
354354
if format.startswith('%d') and str[0] == '0':
355355
return ' ' + str[1:]

test/db_test_base.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: db_test_base.py,v 1.27.2.1 2004-05-16 09:33:14 richard Exp $
18+
# $Id: db_test_base.py,v 1.27.2.2 2004-06-08 05:35:44 richard Exp $
1919

2020
import unittest, os, shutil, errno, imp, sys, time, pprint
2121

@@ -960,11 +960,13 @@ def testImportExport(self):
960960

961961
# grab the export
962962
export = {}
963+
journals = {}
963964
for cn,klass in self.db.classes.items():
964965
names = klass.getprops().keys()
965966
cl = export[cn] = [names+['is retired']]
966967
for id in klass.getnodeids():
967968
cl.append(klass.export_list(names, id))
969+
journals[cn] = klass.export_journals()
968970

969971
# shut down this db and nuke it
970972
self.db.close()
@@ -983,6 +985,7 @@ def testImportExport(self):
983985
for itemprops in items[1:]:
984986
maxid = max(maxid, int(klass.import_list(names, itemprops)))
985987
self.db.setid(cn, str(maxid+1))
988+
klass.import_journals(journals[cn])
986989

987990
# compare with snapshot of the database
988991
for cn, items in orig.items():

0 commit comments

Comments
 (0)