|
15 | 15 | # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
16 | 16 | # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
17 | 17 | # |
18 | | -# $Id: hyperdb.py,v 1.69.2.2 2002-09-03 02:55:26 richard Exp $ |
| 18 | +# $Id: hyperdb.py,v 1.69.2.3 2002-09-03 03:28:26 richard Exp $ |
19 | 19 |
|
20 | 20 | __doc__ = """ |
21 | 21 | Hyperdatabase implementation, especially field types. |
@@ -397,7 +397,7 @@ def create(self, **propvalues): |
397 | 397 | raise KeyError, '"%s" has no property "%s"'%(self.classname, |
398 | 398 | key) |
399 | 399 |
|
400 | | - if isinstance(prop, Link): |
| 400 | + if value is not None and isinstance(prop, Link): |
401 | 401 | if type(value) != type(''): |
402 | 402 | raise ValueError, 'link value must be String' |
403 | 403 | link_class = self.properties[key].classname |
@@ -589,16 +589,18 @@ class or a KeyError is raised. |
589 | 589 | if isinstance(prop, Link): |
590 | 590 | link_class = self.properties[key].classname |
591 | 591 | # if it isn't a number, it's a key |
592 | | - if type(value) != type(''): |
593 | | - raise ValueError, 'link value must be String' |
594 | | - if not num_re.match(value): |
| 592 | + if value is not None and not isinstance(value, type('')): |
| 593 | + raise ValueError, 'property "%s" link value be a string'%( |
| 594 | + key) |
| 595 | + if isinstance(value, type('')) and not num_re.match(value): |
595 | 596 | try: |
596 | 597 | value = self.db.classes[link_class].lookup(value) |
597 | 598 | except (TypeError, KeyError): |
598 | 599 | raise IndexError, 'new property "%s": %s not a %s'%( |
599 | 600 | key, value, self.properties[key].classname) |
600 | 601 |
|
601 | | - if not self.db.hasnode(link_class, value): |
| 602 | + if (value is not None and |
| 603 | + not self.db.getclass(link_class).hasnode(value)): |
602 | 604 | raise IndexError, '%s has no node %s'%(link_class, value) |
603 | 605 |
|
604 | 606 | if self.properties[key].do_journal: |
@@ -1188,6 +1190,9 @@ def Choice(name, db, *options): |
1188 | 1190 |
|
1189 | 1191 | # |
1190 | 1192 | # $Log: not supported by cvs2svn $ |
| 1193 | +# Revision 1.69.2.2 2002/09/03 02:55:26 richard |
| 1194 | +# bug in multilink meant changes might not be detected correctly |
| 1195 | +# |
1191 | 1196 | # Revision 1.69.2.1 2002/07/10 06:30:47 richard |
1192 | 1197 | # . #571170 ] gdbm deadlock |
1193 | 1198 | # |
|
0 commit comments