1515# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717#
18- # $Id: hyperdb.py,v 1.61 2002-04-03 06:11:51 richard Exp $
18+ # $Id: hyperdb.py,v 1.62 2002-04-03 07:05:50 richard Exp $
1919
2020__doc__ = """
2121Hyperdatabase implementation, especially field types.
@@ -179,6 +179,13 @@ def serialise(self, classname, node):
179179 properties = self .getclass (classname ).getprops ()
180180 d = {}
181181 for k , v in node .items ():
182+ # if the property doesn't exist, or is the "retired" flag then
183+ # it won't be in the properties dict
184+ if not properties .has_key (k ):
185+ d [k ] = v
186+ continue
187+
188+ # get the property spec
182189 prop = properties [k ]
183190
184191 if isinstance (prop , Password ):
@@ -203,10 +210,15 @@ def unserialise(self, classname, node):
203210 properties = self .getclass (classname ).getprops ()
204211 d = {}
205212 for k , v in node .items ():
206- # avoid properties that don't exist any more
213+ # if the property doesn't exist, or is the "retired" flag then
214+ # it won't be in the properties dict
207215 if not properties .has_key (k ):
216+ d [k ] = v
208217 continue
218+
219+ # get the property spec
209220 prop = properties [k ]
221+
210222 if isinstance (prop , Date ) and v is not None :
211223 d [k ] = date .Date (v )
212224 elif isinstance (prop , Interval ) and v is not None :
@@ -1115,6 +1127,9 @@ def Choice(name, db, *options):
11151127
11161128#
11171129# $Log: not supported by cvs2svn $
1130+ # Revision 1.61 2002/04/03 06:11:51 richard
1131+ # Fix for old databases that contain properties that don't exist any more.
1132+ #
11181133# Revision 1.60 2002/04/03 05:54:31 richard
11191134# Fixed serialisation problem by moving the serialisation step out of the
11201135# hyperdb.Class (get, set) into the hyperdb.Database.
0 commit comments