diff roundup/backends/rdbms_common.py @ 4430:f2f2904fe6ce

- refactor: move import_journal to hyperdb .-- it was reimplemented in back_anydbm and rdbms_common and was already inconsistent -- and it doen't have any backend dependencies itself. Interestingly this now fails a test for memorydb (but passes for anydbm: Huh?)
author Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
date Thu, 07 Oct 2010 12:22:10 +0000
parents d75e92fbfcca
children 2784c239e6c8
line wrap: on
line diff
--- a/roundup/backends/rdbms_common.py	Thu Oct 07 12:02:12 2010 +0000
+++ b/roundup/backends/rdbms_common.py	Thu Oct 07 12:22:10 2010 +0000
@@ -2641,55 +2641,6 @@
                 r.append(list(map(repr, l)))
         return r
 
-    def import_journals(self, entries):
-        """Import a class's journal.
-
-        Uses setjournal() to set the journal for each item.
-        Strategy for import: Sort first by id, then import journals for
-        each id, this way the memory footprint is a lot smaller than the
-        initial implementation which stored everything in a big hash by
-        id and then proceeded to import journals for each id."""
-        properties = self.getprops()
-        a = []
-        for l in entries:
-            # first element in sorted list is the (numeric) id
-            # in python2.4 and up we would use sorted with a key...
-            a.append ((int (l [0].strip ("'")), l))
-        a.sort ()
-
-
-        last = 0
-        r = []
-        for n, l in a:
-            nodeid, jdate, user, action, params = map(eval, l)
-            assert (str(n) == nodeid)
-            if n != last:
-                if r:
-                    self.db.setjournal(self.classname, nodeid, r)
-                last = n
-                r = []
-
-            if action == 'set':
-                for propname, value in params.iteritems():
-                    prop = properties[propname]
-                    if value is None:
-                        pass
-                    elif isinstance(prop, Date):
-                        value = date.Date(value)
-                    elif isinstance(prop, Interval):
-                        value = date.Interval(value)
-                    elif isinstance(prop, Password):
-                        pwd = password.Password()
-                        pwd.unpack(value)
-                        value = pwd
-                    params[propname] = value
-            elif action == 'create' and params:
-                # old tracker with data stored in the create!
-                params = {}
-            r.append((nodeid, date.Date(jdate), user, action, params))
-        if r:
-            self.db.setjournal(self.classname, nodeid, r)
-
 class FileClass(hyperdb.FileClass, Class):
     """This class defines a large chunk of data. To support this, it has a
        mandatory String property "content" which is typically saved off

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