summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8eef664)
raw | patch | inline | side by side (parent: 8eef664)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Fri, 27 Jul 2001 06:25:35 +0000 (06:25 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Fri, 27 Jul 2001 06:25:35 +0000 (06:25 +0000) |
Removed the str()-ification of node ids so we don't mask oopsy errors any
more.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@94 57a73879-2fb5-44c3-a270-3262357dd7e2
more.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@94 57a73879-2fb5-44c3-a270-3262357dd7e2
roundup/hyperdb.py | patch | blob | history |
diff --git a/roundup/hyperdb.py b/roundup/hyperdb.py
index 2e62efb6d5ec1a7e811d91e99f714a89b642a794..62f25b77fd18e2b37060d5728a5f3132d8143e3f 100644 (file)
--- a/roundup/hyperdb.py
+++ b/roundup/hyperdb.py
-# $Id: hyperdb.py,v 1.3 2001-07-27 05:17:14 richard Exp $
+# $Id: hyperdb.py,v 1.4 2001-07-27 06:25:35 richard Exp $
# standard python modules
import cPickle, re, string
prop = self.properties[key]
if prop.isLinkType:
- value = str(value)
+ if type(value) != type(''):
+ raise ValueError, 'link value must be String'
+# value = str(value)
link_class = self.properties[key].classname
+ # if it isn't a number, it's a key
if not num_re.match(value):
try:
value = self.db.classes[link_class].lookup(value)
except:
- raise ValueError, 'new property "%s": %s not a %s'%(
+ raise IndexError, 'new property "%s": %s not a %s'%(
key, value, self.properties[key].classname)
propvalues[key] = value
if not self.db.hasnode(link_class, value):
- raise ValueError, '%s has no node %s'%(link_class, value)
+ raise IndexError, '%s has no node %s'%(link_class, value)
# register the link with the newly linked node
self.db.addjournal(link_class, value, 'link',
raise TypeError, 'new property "%s" not a list of ids'%key
link_class = self.properties[key].classname
l = []
- for entry in map(str, value):
+ for entry in value:
+ if type(entry) != type(''):
+ raise ValueError, 'link value must be String'
+ # if it isn't a number, it's a key
if not num_re.match(entry):
try:
entry = self.db.classes[link_class].lookup(entry)
except:
- raise ValueError, 'new property "%s": %s not a %s'%(
+ raise IndexError, 'new property "%s": %s not a %s'%(
key, entry, self.properties[key].classname)
l.append(entry)
value = l
# handle additions
for id in value:
if not self.db.hasnode(link_class, id):
- raise ValueError, '%s has no node %s'%(link_class, id)
+ raise IndexError, '%s has no node %s'%(link_class, id)
# register the link with the newly linked node
self.db.addjournal(link_class, id, 'link',
(self.classname, newid, key))
if not hasattr(value, 'isInterval'):
raise TypeError, 'new property "%s" not an Interval'% key
- for key,prop in self.properties.items():
- if propvalues.has_key(str(key)):
+ for key, prop in self.properties.items():
+ if propvalues.has_key(key):
continue
if prop.isMultilinkType:
propvalues[key] = []
IndexError is raised. 'propname' must be the name of a property
of this class or a KeyError is raised.
"""
- d = self.db.getnode(self.classname, str(nodeid))
+# nodeid = str(nodeid)
+ d = self.db.getnode(self.classname, nodeid)
return d[propname]
# XXX not in spec
return
if self.db.journaltag is None:
raise DatabaseError, 'Database open read-only'
- nodeid = str(nodeid)
+# nodeid = str(nodeid)
node = self.db.getnode(self.classname, nodeid)
if node.has_key(self.db.RETIRED_FLAG):
raise IndexError
prop = self.properties[key]
if prop.isLinkType:
- value = str(value)
+# value = str(value)
link_class = self.properties[key].classname
+ # if it isn't a number, it's a key
+ if type(value) != type(''):
+ raise ValueError, 'link value must be String'
if not num_re.match(value):
try:
value = self.db.classes[link_class].lookup(value)
except:
- raise ValueError, 'new property "%s": %s not a %s'%(
+ raise IndexError, 'new property "%s": %s not a %s'%(
key, value, self.properties[key].classname)
if not self.db.hasnode(link_class, value):
- raise ValueError, '%s has no node %s'%(link_class, value)
+ raise IndexError, '%s has no node %s'%(link_class, value)
# register the unlink with the old linked node
if node[key] is not None:
raise TypeError, 'new property "%s" not a list of ids'%key
link_class = self.properties[key].classname
l = []
- for entry in map(str, value):
+ for entry in value:
+ # if it isn't a number, it's a key
+ if type(entry) != type(''):
+ raise ValueError, 'link value must be String'
if not num_re.match(entry):
try:
entry = self.db.classes[link_class].lookup(entry)
except:
- raise ValueError, 'new property "%s": %s not a %s'%(
+ raise IndexError, 'new property "%s": %s not a %s'%(
key, entry, self.properties[key].classname)
l.append(entry)
value = l
# handle additions
for id in value:
if not self.db.hasnode(link_class, id):
- raise ValueError, '%s has no node %s'%(link_class, id)
+ raise IndexError, '%s has no node %s'%(link_class, id)
if id in l:
continue
# register the link with the newly linked node
Retired nodes are not returned by the find(), list(), or lookup()
methods, and other nodes may reuse the values of their key properties.
"""
- nodeid = str(nodeid)
+# nodeid = str(nodeid)
if self.db.journaltag is None:
raise DatabaseError, 'Database open read-only'
node = self.db.getnode(self.classname, nodeid)
"""
propspec = propspec.items()
for propname, nodeid in propspec:
- nodeid = str(nodeid)
+# nodeid = str(nodeid)
# check the prop is OK
prop = self.properties[propname]
if not prop.isLinkType and not prop.isMultilinkType:
if node.has_key(self.db.RETIRED_FLAG):
continue
for propname, nodeid in propspec:
- nodeid = str(nodeid)
+# nodeid = str(nodeid)
property = node[propname]
if prop.isLinkType and nodeid == property:
l.append(id)
#
# $Log: not supported by cvs2svn $
+# Revision 1.3 2001/07/27 05:17:14 richard
+# just some comments
+#
# Revision 1.2 2001/07/22 12:09:32 richard
# Final commit of Grande Splite
#