Mercurial > p > roundup > code
comparison roundup/hyperdb.py @ 648:07422fe57db2
Ran it through pychecker, made fixes
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 27 Feb 2002 03:23:16 +0000 |
| parents | 923de4949369 |
| children | e0a1cc7538e9 |
comparison
equal
deleted
inserted
replaced
| 647:b3b483e0fd5e | 648:07422fe57db2 |
|---|---|
| 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.57 2002-02-20 05:23:24 richard Exp $ | 18 # $Id: hyperdb.py,v 1.58 2002-02-27 03:23:16 richard Exp $ |
| 19 | 19 |
| 20 __doc__ = """ | 20 __doc__ = """ |
| 21 Hyperdatabase implementation, especially field types. | 21 Hyperdatabase implementation, especially field types. |
| 22 """ | 22 """ |
| 23 | 23 |
| 24 # standard python modules | 24 # standard python modules |
| 25 import cPickle, re, string, weakref, os | 25 import re, string, weakref, os |
| 26 | 26 |
| 27 # roundup modules | 27 # roundup modules |
| 28 import date, password | 28 import date, password |
| 29 | 29 |
| 30 DEBUG = os.environ.get('HYPERDBDEBUG', '') | 30 DEBUG = os.environ.get('HYPERDBDEBUG', '') |
| 488 | 488 |
| 489 node = self.db.getnode(self.classname, nodeid) | 489 node = self.db.getnode(self.classname, nodeid) |
| 490 if node.has_key(self.db.RETIRED_FLAG): | 490 if node.has_key(self.db.RETIRED_FLAG): |
| 491 raise IndexError | 491 raise IndexError |
| 492 num_re = re.compile('^\d+$') | 492 num_re = re.compile('^\d+$') |
| 493 set = {} | |
| 494 for key, value in propvalues.items(): | 493 for key, value in propvalues.items(): |
| 495 # check to make sure we're not duplicating an existing key | 494 # check to make sure we're not duplicating an existing key |
| 496 if key == self.key and node[key] != value: | 495 if key == self.key and node[key] != value: |
| 497 try: | 496 try: |
| 498 self.lookup(value) | 497 self.lookup(value) |
| 1073 return self.cl.history(self.nodeid) | 1072 return self.cl.history(self.nodeid) |
| 1074 def retire(self): | 1073 def retire(self): |
| 1075 return self.cl.retire(self.nodeid) | 1074 return self.cl.retire(self.nodeid) |
| 1076 | 1075 |
| 1077 | 1076 |
| 1078 def Choice(name, *options): | 1077 def Choice(name, db, *options): |
| 1079 cl = Class(db, name, name=hyperdb.String(), order=hyperdb.String()) | 1078 '''Quick helper to create a simple class with choices |
| 1079 ''' | |
| 1080 cl = Class(db, name, name=String(), order=String()) | |
| 1080 for i in range(len(options)): | 1081 for i in range(len(options)): |
| 1081 cl.create(name=option[i], order=i) | 1082 cl.create(name=options[i], order=i) |
| 1082 return hyperdb.Link(name) | 1083 return hyperdb.Link(name) |
| 1083 | 1084 |
| 1084 # | 1085 # |
| 1085 # $Log: not supported by cvs2svn $ | 1086 # $Log: not supported by cvs2svn $ |
| 1087 # Revision 1.57 2002/02/20 05:23:24 richard | |
| 1088 # Didn't accomodate new values for new properties | |
| 1089 # | |
| 1086 # Revision 1.56 2002/02/20 05:05:28 richard | 1090 # Revision 1.56 2002/02/20 05:05:28 richard |
| 1087 # . Added simple editing for classes that don't define a templated interface. | 1091 # . Added simple editing for classes that don't define a templated interface. |
| 1088 # - access using the admin "class list" interface | 1092 # - access using the admin "class list" interface |
| 1089 # - limited to admin-only | 1093 # - limited to admin-only |
| 1090 # - requires the csv module from object-craft (url given if it's missing) | 1094 # - requires the csv module from object-craft (url given if it's missing) |
