diff roundup/backends/back_metakit.py @ 2398:202701d52788

fixed anydbm & metakit import/export ([SF#965216], [SF#964457], [SF#964450])
author Richard Jones <richard@users.sourceforge.net>
date Tue, 08 Jun 2004 05:30:56 +0000
parents 10fc45eea226
children 4bab776d540d
line wrap: on
line diff
--- a/roundup/backends/back_metakit.py	Tue Jun 08 05:29:18 2004 +0000
+++ b/roundup/backends/back_metakit.py	Tue Jun 08 05:30:56 2004 +0000
@@ -1,4 +1,4 @@
-# $Id: back_metakit.py,v 1.72 2004-05-23 23:24:47 richard Exp $
+# $Id: back_metakit.py,v 1.73 2004-06-08 05:30:32 richard Exp $
 '''Metakit backend for Roundup, originally by Gordon McMillan.
 
 Known Current Bugs:
@@ -209,8 +209,8 @@
                          nodeid=int(nodeid),
                          date=creation,
                          action=action,
-                         user = creator,
-                         params = marshal.dumps(params))
+                         user=creator,
+                         params=marshal.dumps(params))
 
     def setjournal(self, tablenm, nodeid, journal):
         '''Set the journal to the "journal" list.'''
@@ -223,7 +223,7 @@
                              nodeid=int(nodeid),
                              date=date,
                              action=action,
-                             user=user,
+                             user=int(user),
                              params=marshal.dumps(params))
 
     def getjournal(self, tablenm, nodeid):
@@ -361,6 +361,15 @@
     _UNLINK : 'unlink',
 }
 
+_names_to_actionnames = {
+    'create': _CREATE,
+    'set': _SET,
+    'retire': _RETIRE,
+    'restore': _RESTORE,
+    'link': _LINK,
+    'unlink': _UNLINK,
+}
+
 _marker = []
 
 _ALLOWSETTINGPRIVATEPROPS = 0
@@ -1700,7 +1709,8 @@
         d = {}
         for l in entries:
             l = map(eval, l)
-            nodeid, date, user, action, params = l
+            nodeid, jdate, user, action, params = l
+            jdate = int(calendar.timegm(date.Date(jdate).get_tuple()))
             r = d.setdefault(nodeid, [])
             if action == 'set':
                 for propname, value in params.items():
@@ -1716,7 +1726,8 @@
                         pwd.unpack(value)
                         value = pwd
                     params[propname] = value
-            r.append((nodeid, date.Date(date), user, action, params))
+            action = _names_to_actionnames[action]
+            r.append((nodeid, jdate, user, action, params))
 
         for nodeid, l in d.items():
             self.db.setjournal(self.classname, nodeid, l)

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