diff --git a/roundup/hyperdb.py b/roundup/hyperdb.py
index e47c85a17584ebebcd362172cf3fa1437295f2a7..9aa575ac63813004cce38c19c62f53cf26501a31 100644 (file)
--- a/roundup/hyperdb.py
+++ b/roundup/hyperdb.py
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: hyperdb.py,v 1.53 2002-01-22 07:21:13 richard Exp $
+# $Id: hyperdb.py,v 1.58 2002-02-27 03:23:16 richard Exp $
__doc__ = """
Hyperdatabase implementation, especially field types.
"""
# standard python modules
-import cPickle, re, string, weakref, os
+import re, string, weakref, os
# roundup modules
import date, password
# the writeable properties.
prop = self.properties[key]
+ # if the value's the same as the existing value, no sense in
+ # doing anything
+ if node.has_key(key) and value == node[key]:
+ del propvalues[key]
+ continue
+
+ # do stuff based on the prop type
if isinstance(prop, Link):
link_class = self.properties[key].classname
# if it isn't a number, it's a key
node[key] = value
+ # nothing to do?
+ if not propvalues:
+ return
+
+ # do the set, and journal it
self.db.setnode(self.classname, nodeid, node)
self.db.addjournal(self.classname, nodeid, 'set', propvalues)
return self.db.getjournal(self.classname, nodeid)
# Locating nodes:
+ def hasnode(self, nodeid):
+ '''Determine if the given nodeid actually exists
+ '''
+ return self.db.hasnode(self.classname, nodeid)
def setkey(self, propname):
"""Select a String property of this class to be the key property.
else:
continue
break
- elif t == 2 and not v.search(node[k]):
+ elif t == 2 and (node[k] is None or not v.search(node[k])):
# RE search
break
elif t == 6 and node[k] != v:
return self.cl.retire(self.nodeid)
-def Choice(name, *options):
- cl = Class(db, name, name=hyperdb.String(), order=hyperdb.String())
+def Choice(name, db, *options):
+ '''Quick helper to create a simple class with choices
+ '''
+ cl = Class(db, name, name=String(), order=String())
for i in range(len(options)):
- cl.create(name=option[i], order=i)
+ cl.create(name=options[i], order=i)
return hyperdb.Link(name)
#
# $Log: not supported by cvs2svn $
+# Revision 1.57 2002/02/20 05:23:24 richard
+# Didn't accomodate new values for new properties
+#
+# Revision 1.56 2002/02/20 05:05:28 richard
+# . Added simple editing for classes that don't define a templated interface.
+# - access using the admin "class list" interface
+# - limited to admin-only
+# - requires the csv module from object-craft (url given if it's missing)
+#
+# Revision 1.55 2002/02/15 07:27:12 richard
+# Oops, precedences around the way w0rng.
+#
+# Revision 1.54 2002/02/15 07:08:44 richard
+# . Alternate email addresses are now available for users. See the MIGRATION
+# file for info on how to activate the feature.
+#
+# Revision 1.53 2002/01/22 07:21:13 richard
+# . fixed back_bsddb so it passed the journal tests
+#
+# ... it didn't seem happy using the back_anydbm _open method, which is odd.
+# Yet another occurrance of whichdb not being able to recognise older bsddb
+# databases. Yadda yadda. Made the HYPERDBDEBUG stuff more sane in the
+# process.
+#
# Revision 1.52 2002/01/21 16:33:19 rochecompaan
# You can now use the roundup-admin tool to pack the database
#