diff roundup/backends/back_anydbm.py @ 1484:b3f2484babce

fixes to import/export
author Richard Jones <richard@users.sourceforge.net>
date Fri, 28 Feb 2003 03:33:46 +0000
parents 5a01e90b7dc9
children f5f60c75a458
line wrap: on
line diff
--- a/roundup/backends/back_anydbm.py	Fri Feb 28 03:33:25 2003 +0000
+++ b/roundup/backends/back_anydbm.py	Fri Feb 28 03:33:46 2003 +0000
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-#$Id: back_anydbm.py,v 1.106 2003-02-26 23:42:50 richard Exp $
+#$Id: back_anydbm.py,v 1.107 2003-02-28 03:33:46 richard Exp $
 '''
 This module defines a backend that saves the hyperdatabase in a database
 chosen by anydbm. It is guaranteed to always be available in python
@@ -448,28 +448,6 @@
         count = count + len(db.keys())
         return count
 
-    def getnodeids(self, classname, db=None):
-        if __debug__:
-            print >>hyperdb.DEBUG, 'getnodeids', (self, classname, db)
-
-        res = []
-
-        # start off with the new nodes
-        if self.newnodes.has_key(classname):
-            res += self.newnodes[classname].keys()
-
-        if db is None:
-            db = self.getclassdb(classname)
-        res = res + db.keys()
-
-        # remove the uncommitted, destroyed nodes
-        if self.destroyednodes.has_key(classname):
-            for nodeid in self.destroyednodes[classname].keys():
-                if db.has_key(nodeid):
-                    res.remove(nodeid)
-
-        return res
-
 
     #
     # Files - special node properties
@@ -1435,7 +1413,7 @@
             raise TypeError, 'No key property set for class %s'%self.classname
         cldb = self.db.getclassdb(self.classname)
         try:
-            for nodeid in self.db.getnodeids(self.classname, cldb):
+            for nodeid in self.getnodeids(cldb):
                 node = self.db.getnode(self.classname, nodeid, cldb)
                 if node.has_key(self.db.RETIRED_FLAG):
                     continue
@@ -1474,7 +1452,7 @@
         cldb = self.db.getclassdb(self.classname)
         l = []
         try:
-            for id in self.db.getnodeids(self.classname, db=cldb):
+            for id in self.getnodeids(db=cldb):
                 node = self.db.getnode(self.classname, id, db=cldb)
                 if node.has_key(self.db.RETIRED_FLAG):
                     continue
@@ -1518,7 +1496,7 @@
         l = []
         cldb = self.db.getclassdb(self.classname)
         try:
-            for nodeid in self.db.getnodeids(self.classname, cldb):
+            for nodeid in self.getnodeids(cldb):
                 node = self.db.getnode(self.classname, nodeid, cldb)
                 if node.has_key(self.db.RETIRED_FLAG):
                     continue
@@ -1540,7 +1518,7 @@
         cn = self.classname
         cldb = self.db.getclassdb(cn)
         try:
-            for nodeid in self.db.getnodeids(cn, cldb):
+            for nodeid in self.getnodeids(cldb):
                 node = self.db.getnode(cn, nodeid, cldb)
                 if node.has_key(self.db.RETIRED_FLAG):
                     continue
@@ -1550,6 +1528,30 @@
         l.sort()
         return l
 
+    def getnodeids(self, db=None):
+        ''' Return a list of ALL nodeids
+        '''
+        if __debug__:
+            print >>hyperdb.DEBUG, 'getnodeids', (self, self.classname, db)
+
+        res = []
+
+        # start off with the new nodes
+        if self.db.newnodes.has_key(classname):
+            res += self.db.newnodes[classname].keys()
+
+        if db is None:
+            db = self.db.getclassdb(classname)
+        res = res + db.keys()
+
+        # remove the uncommitted, destroyed nodes
+        if self.db.destroyednodes.has_key(classname):
+            for nodeid in self.db.destroyednodes[classname].keys():
+                if db.has_key(nodeid):
+                    res.remove(nodeid)
+
+        return res
+
     def filter(self, search_matches, filterspec, sort=(None,None),
             group=(None,None), num_re = re.compile('^\d+$')):
         ''' Return a list of the ids of the active nodes in this class that
@@ -1635,7 +1637,7 @@
         cldb = self.db.getclassdb(cn)
         try:
             # TODO: only full-scan once (use items())
-            for nodeid in self.db.getnodeids(cn, cldb):
+            for nodeid in self.getnodeids(cldb):
                 node = self.db.getnode(cn, nodeid, cldb)
                 if node.has_key(self.db.RETIRED_FLAG):
                     continue

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