diff roundup/backends/back_anydbm.py @ 3872:34128a809e22

Allow multilinks to take None (treated as an empty list). Add a testcase for it.
author Justus Pendleton <jpend@users.sourceforge.net>
date Fri, 31 Aug 2007 15:44:03 +0000
parents 16faac822fe5
children e2c2d91932ad
line wrap: on
line diff
--- a/roundup/backends/back_anydbm.py	Thu Aug 30 00:31:16 2007 +0000
+++ b/roundup/backends/back_anydbm.py	Fri Aug 31 15:44:03 2007 +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.204 2007-08-29 16:40:20 jpend Exp $
+#$Id: back_anydbm.py,v 1.205 2007-08-31 15:44:02 jpend 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
 versions >2.1.1 (the dumbdbm fallback in 2.1.1 and earlier has several
@@ -840,6 +840,8 @@
                         (self.classname, newid, key))
 
             elif isinstance(prop, hyperdb.Multilink):
+                if value is None:
+                    value = []
                 if not hasattr(value, '__iter__'):
                     raise TypeError, 'new property "%s" not an iterable of ids'%key
 
@@ -1132,6 +1134,8 @@
                             (self.classname, nodeid, propname))
 
             elif isinstance(prop, hyperdb.Multilink):
+                if value is None:
+                    value = []
                 if not hasattr(value, '__iter__'):
                     raise TypeError, 'new property "%s" not an iterable of'\
                         ' ids'%propname

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