Mercurial > p > roundup > code
diff roundup/backends/back_anydbm.py @ 2609:c938aa0af17d maint-0.7
merge from HEAD
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 21 Jul 2004 01:02:15 +0000 |
| parents | b1bf4aee5def |
| children | eaf74cf96cfa |
line wrap: on
line diff
--- a/roundup/backends/back_anydbm.py Wed Jul 21 00:51:49 2004 +0000 +++ b/roundup/backends/back_anydbm.py Wed Jul 21 01:02:15 2004 +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.146.2.16 2004-07-21 00:51:49 richard Exp $ +#$Id: back_anydbm.py,v 1.146.2.17 2004-07-21 01:02:15 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 versions >2.1.1 (the dumbdbm fallback in 2.1.1 and earlier has several @@ -1074,6 +1074,13 @@ ''' self.fireAuditors('set', nodeid, propvalues) oldvalues = copy.deepcopy(self.db.getnode(self.classname, nodeid)) + for name,prop in self.getprops(protected=0).items(): + if oldvalues.has_key(name): + continue + if isinstance(prop, Multilink): + oldvalues[name] = [] + else: + oldvalues[name] = None propvalues = self.set_inner(nodeid, **propvalues) self.fireReactors('set', nodeid, oldvalues) return propvalues @@ -2134,7 +2141,16 @@ ''' Snarf the "content" propvalue and update it in a file ''' self.fireAuditors('set', itemid, propvalues) + + # create the oldvalues dict - fill in any missing values oldvalues = copy.deepcopy(self.db.getnode(self.classname, itemid)) + for name,prop in self.getprops(protected=0).items(): + if oldvalues.has_key(name): + continue + if isinstance(prop, Multilink): + oldvalues[name] = [] + else: + oldvalues[name] = None # now remove the content property so it's not stored in the db content = None
