Mercurial > p > roundup > code
comparison roundup/hyperdb.py @ 395:d4b19c2ee740
Better handling of new properties.
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 21 Nov 2001 03:11:28 +0000 |
| parents | a1331423eb93 |
| children | d47818b09265 |
comparison
equal
deleted
inserted
replaced
| 394:f43af1e97fdd | 395:d4b19c2ee740 |
|---|---|
| 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.31 2001-11-12 22:01:06 richard Exp $ | 18 # $Id: hyperdb.py,v 1.32 2001-11-21 03:11:28 richard Exp $ |
| 19 | 19 |
| 20 # standard python modules | 20 # standard python modules |
| 21 import cPickle, re, string | 21 import cPickle, re, string |
| 22 | 22 |
| 23 # roundup modules | 23 # roundup modules |
| 293 node = self.db.getnode(self.classname, nodeid) | 293 node = self.db.getnode(self.classname, nodeid) |
| 294 if node.has_key(self.db.RETIRED_FLAG): | 294 if node.has_key(self.db.RETIRED_FLAG): |
| 295 raise IndexError | 295 raise IndexError |
| 296 num_re = re.compile('^\d+$') | 296 num_re = re.compile('^\d+$') |
| 297 for key, value in propvalues.items(): | 297 for key, value in propvalues.items(): |
| 298 if not node.has_key(key): | |
| 299 raise KeyError, key | |
| 300 | |
| 301 # check to make sure we're not duplicating an existing key | 298 # check to make sure we're not duplicating an existing key |
| 302 if key == self.key and node[key] != value: | 299 if key == self.key and node[key] != value: |
| 303 try: | 300 try: |
| 304 self.lookup(value) | 301 self.lookup(value) |
| 305 except KeyError: | 302 except KeyError: |
| 306 pass | 303 pass |
| 307 else: | 304 else: |
| 308 raise ValueError, 'node with key "%s" exists'%value | 305 raise ValueError, 'node with key "%s" exists'%value |
| 309 | 306 |
| 307 # this will raise the KeyError if the property isn't valid | |
| 310 prop = self.properties[key] | 308 prop = self.properties[key] |
| 311 | 309 |
| 312 if isinstance(prop, Link): | 310 if isinstance(prop, Link): |
| 313 link_class = self.properties[key].classname | 311 link_class = self.properties[key].classname |
| 314 # if it isn't a number, it's a key | 312 # if it isn't a number, it's a key |
| 847 cl.create(name=option[i], order=i) | 845 cl.create(name=option[i], order=i) |
| 848 return hyperdb.Link(name) | 846 return hyperdb.Link(name) |
| 849 | 847 |
| 850 # | 848 # |
| 851 # $Log: not supported by cvs2svn $ | 849 # $Log: not supported by cvs2svn $ |
| 850 # Revision 1.31 2001/11/12 22:01:06 richard | |
| 851 # Fixed issues with nosy reaction and author copies. | |
| 852 # | |
| 852 # Revision 1.30 2001/11/09 10:11:08 richard | 853 # Revision 1.30 2001/11/09 10:11:08 richard |
| 853 # . roundup-admin now handles all hyperdb exceptions | 854 # . roundup-admin now handles all hyperdb exceptions |
| 854 # | 855 # |
| 855 # Revision 1.29 2001/10/27 00:17:41 richard | 856 # Revision 1.29 2001/10/27 00:17:41 richard |
| 856 # Made Class.stringFind() do caseless matching. | 857 # Made Class.stringFind() do caseless matching. |
