comparison roundup/hyperdb.py @ 679:5a4dd342d827

d'oh! killed retirement of nodes :( all better now...
author Richard Jones <richard@users.sourceforge.net>
date Wed, 03 Apr 2002 07:05:50 +0000
parents 8d3cc8352b89
children 509a101305da
comparison
equal deleted inserted replaced
678:9fe50036e8df 679:5a4dd342d827
13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
17 # 17 #
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 $
19 19
20 __doc__ = """ 20 __doc__ = """
21 Hyperdatabase implementation, especially field types. 21 Hyperdatabase implementation, especially field types.
22 """ 22 """
23 23
177 ''' 177 '''
178 if DEBUG: print 'serialise', classname, node 178 if DEBUG: print 'serialise', classname, node
179 properties = self.getclass(classname).getprops() 179 properties = self.getclass(classname).getprops()
180 d = {} 180 d = {}
181 for k, v in node.items(): 181 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
182 prop = properties[k] 189 prop = properties[k]
183 190
184 if isinstance(prop, Password): 191 if isinstance(prop, Password):
185 d[k] = str(v) 192 d[k] = str(v)
186 elif isinstance(prop, Date) and v is not None: 193 elif isinstance(prop, Date) and v is not None:
201 ''' 208 '''
202 if DEBUG: print 'unserialise', classname, node 209 if DEBUG: print 'unserialise', classname, node
203 properties = self.getclass(classname).getprops() 210 properties = self.getclass(classname).getprops()
204 d = {} 211 d = {}
205 for k, v in node.items(): 212 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
207 if not properties.has_key(k): 215 if not properties.has_key(k):
216 d[k] = v
208 continue 217 continue
218
219 # get the property spec
209 prop = properties[k] 220 prop = properties[k]
221
210 if isinstance(prop, Date) and v is not None: 222 if isinstance(prop, Date) and v is not None:
211 d[k] = date.Date(v) 223 d[k] = date.Date(v)
212 elif isinstance(prop, Interval) and v is not None: 224 elif isinstance(prop, Interval) and v is not None:
213 d[k] = date.Interval(v) 225 d[k] = date.Interval(v)
214 elif isinstance(prop, Password): 226 elif isinstance(prop, Password):
1113 cl.create(name=options[i], order=i) 1125 cl.create(name=options[i], order=i)
1114 return hyperdb.Link(name) 1126 return hyperdb.Link(name)
1115 1127
1116 # 1128 #
1117 # $Log: not supported by cvs2svn $ 1129 # $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 #
1118 # Revision 1.60 2002/04/03 05:54:31 richard 1133 # Revision 1.60 2002/04/03 05:54:31 richard
1119 # Fixed serialisation problem by moving the serialisation step out of the 1134 # Fixed serialisation problem by moving the serialisation step out of the
1120 # hyperdb.Class (get, set) into the hyperdb.Database. 1135 # hyperdb.Class (get, set) into the hyperdb.Database.
1121 # 1136 #
1122 # Also fixed htmltemplate after the showid changes I made yesterday. 1137 # Also fixed htmltemplate after the showid changes I made yesterday.

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