Mercurial > p > roundup > code
comparison roundup/hyperdb.py @ 677:8d3cc8352b89
Fix for old databases that contain properties that don't exist any more.
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 03 Apr 2002 06:11:51 +0000 |
| parents | bc46480e2a2b |
| children | 5a4dd342d827 |
comparison
equal
deleted
inserted
replaced
| 676:bc46480e2a2b | 677:8d3cc8352b89 |
|---|---|
| 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.60 2002-04-03 05:54:31 richard Exp $ | 18 # $Id: hyperdb.py,v 1.61 2002-04-03 06:11:51 richard Exp $ |
| 19 | 19 |
| 20 __doc__ = """ | 20 __doc__ = """ |
| 21 Hyperdatabase implementation, especially field types. | 21 Hyperdatabase implementation, especially field types. |
| 22 """ | 22 """ |
| 23 | 23 |
| 201 ''' | 201 ''' |
| 202 if DEBUG: print 'unserialise', classname, node | 202 if DEBUG: print 'unserialise', classname, node |
| 203 properties = self.getclass(classname).getprops() | 203 properties = self.getclass(classname).getprops() |
| 204 d = {} | 204 d = {} |
| 205 for k, v in node.items(): | 205 for k, v in node.items(): |
| 206 # avoid properties that don't exist any more | |
| 207 if not properties.has_key(k): | |
| 208 continue | |
| 206 prop = properties[k] | 209 prop = properties[k] |
| 207 if isinstance(prop, Date) and v is not None: | 210 if isinstance(prop, Date) and v is not None: |
| 208 d[k] = date.Date(v) | 211 d[k] = date.Date(v) |
| 209 elif isinstance(prop, Interval) and v is not None: | 212 elif isinstance(prop, Interval) and v is not None: |
| 210 d[k] = date.Interval(v) | 213 d[k] = date.Interval(v) |
| 1110 cl.create(name=options[i], order=i) | 1113 cl.create(name=options[i], order=i) |
| 1111 return hyperdb.Link(name) | 1114 return hyperdb.Link(name) |
| 1112 | 1115 |
| 1113 # | 1116 # |
| 1114 # $Log: not supported by cvs2svn $ | 1117 # $Log: not supported by cvs2svn $ |
| 1118 # Revision 1.60 2002/04/03 05:54:31 richard | |
| 1119 # Fixed serialisation problem by moving the serialisation step out of the | |
| 1120 # hyperdb.Class (get, set) into the hyperdb.Database. | |
| 1121 # | |
| 1122 # Also fixed htmltemplate after the showid changes I made yesterday. | |
| 1123 # | |
| 1124 # Unit tests for all of the above written. | |
| 1125 # | |
| 1115 # Revision 1.59 2002/03/12 22:52:26 richard | 1126 # Revision 1.59 2002/03/12 22:52:26 richard |
| 1116 # more pychecker warnings removed | 1127 # more pychecker warnings removed |
| 1117 # | 1128 # |
| 1118 # Revision 1.58 2002/02/27 03:23:16 richard | 1129 # Revision 1.58 2002/02/27 03:23:16 richard |
| 1119 # Ran it through pychecker, made fixes | 1130 # Ran it through pychecker, made fixes |
