summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a6ce841)
raw | patch | inline | side by side (parent: a6ce841)
author | schlatterbeck <schlatterbeck@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Thu, 7 Oct 2010 12:22:10 +0000 (12:22 +0000) | ||
committer | schlatterbeck <schlatterbeck@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Thu, 7 Oct 2010 12:22:10 +0000 (12:22 +0000) |
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?)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4538 57a73879-2fb5-44c3-a270-3262357dd7e2
doen't have any backend dependencies itself.
Interestingly this now fails a test for memorydb (but passes for
anydbm: Huh?)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4538 57a73879-2fb5-44c3-a270-3262357dd7e2
CHANGES.txt | patch | blob | history | |
roundup/backends/back_anydbm.py | patch | blob | history | |
roundup/backends/rdbms_common.py | patch | blob | history | |
roundup/hyperdb.py | patch | blob | history |
diff --git a/CHANGES.txt b/CHANGES.txt
index 246023eee1882c5cf4773ed3ee683e416ca89a49..012145845d76c8bdd08c8bb3e96c7cb58569eab1 100644 (file)
--- a/CHANGES.txt
+++ b/CHANGES.txt
Thanks to Benni Bärmann for reporting.
- Allow search_popup macro to work with all db classes, issue2550567
(thanks John Kristensen)
-- lower memory footprint for (journal-) import -- only for rdbms
- backends, other backends shouldn't have that much data anyway.
+- lower memory footprint for (journal-) import
2010-07-12 1.4.15
index 463a43f56011f4fd43b2e5936d88f6bbfc0e5106..3d132ec672062730b2446ee3dd1ac6d369588ed2 100644 (file)
repr(action), repr(params)])
return r
- def import_journals(self, entries):
- """Import a class's journal.
-
- Uses setjournal() to set the journal for each item."""
- properties = self.getprops()
- d = {}
- for l in entries:
- nodeid, jdate, user, action, params = tuple(map(eval, l))
- r = d.setdefault(nodeid, [])
- if action == 'set':
- for propname, value in params.iteritems():
- prop = properties[propname]
- if value is None:
- pass
- elif isinstance(prop, hyperdb.Date):
- value = date.Date(value)
- elif isinstance(prop, hyperdb.Interval):
- value = date.Interval(value)
- elif isinstance(prop, hyperdb.Password):
- pwd = password.Password()
- pwd.unpack(value)
- value = pwd
- params[propname] = value
- r.append((nodeid, date.Date(jdate), user, action, params))
-
- for nodeid, l in d.iteritems():
- self.db.setjournal(self.classname, nodeid, l)
-
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
index 5b19850423333c96ca6dec326915f79c3a8d8b91..13589a222eae7958c8c84a25879da53d41374e18 100644 (file)
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
diff --git a/roundup/hyperdb.py b/roundup/hyperdb.py
index 93f93b8c315738f1384ac329c81482f82cd3e085..3a7ad592cad8a38633516ae32f2ad2e85d51556e 100644 (file)
--- a/roundup/hyperdb.py
+++ b/roundup/hyperdb.py
propnames = self.getprops().keys()
propnames.sort()
return propnames
+
+ 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)
+
#
# convenience methods
#