diff --git a/roundup/hyperdb.py b/roundup/hyperdb.py
index 4c13318efb13dac271743e2cf371d39f3c1874b6..252194c0c93636a041f3a316d733841848c0f9a8 100644 (file)
--- a/roundup/hyperdb.py
+++ b/roundup/hyperdb.py
-# $Id: hyperdb.py,v 1.5 2001-07-29 04:05:37 richard Exp $
+# $Id: hyperdb.py,v 1.9 2001-07-29 09:28:23 richard Exp $
# standard python modules
import cPickle, re, string
"""Return the name of the key property for this class or None."""
return self.key
+ def labelprop(self):
+ ''' Return the property name for a label for the given node.
+
+ This method attempts to generate a consistent label for the node.
+ It tries the following in order:
+ 1. key property
+ 2. "name" property
+ 3. "title" property
+ 4. first property from the sorted property name list
+ '''
+ k = self.getkey()
+ if k:
+ return k
+ props = self.getprops()
+ if props.has_key('name'):
+ return 'name'
+ elif props.has_key('title'):
+ return 'title'
+ props = props.keys()
+ props.sort()
+ return props[0]
+
# TODO: set up a separate index db file for this? profile?
def lookup(self, keyvalue):
"""Locate a particular node by its key property and return its id.
u.append(entry)
l.append((1, k, u))
elif propclass.isStringType:
- v = v[0]
if '*' in v or '?' in v:
# simple glob searching
v = v.replace('?', '.')
else:
m.append((entry[0], entry[1:]))
group = m
-
# now, sort the result
def sortfun(a, b, sort=sort, group=group, properties=self.getprops(),
db = self.db, cl=self):
# nodes; or finally on the node ids.
elif propclass.isLinkType:
link = db.classes[propclass.classname]
+ if av is None and bv is not None: return -1
+ if av is not None and bv is None: return 1
+ if av is None and bv is None: return 0
if link.getprops().has_key('order'):
if dir == '+':
r = cmp(link.get(av, 'order'),
#
# $Log: not supported by cvs2svn $
+# Revision 1.8 2001/07/29 08:27:40 richard
+# Fixed handling of passed-in values in form elements (ie. during a
+# drill-down)
+#
+# Revision 1.7 2001/07/29 07:01:39 richard
+# Added vim command to all source so that we don't get no steenkin' tabs :)
+#
+# Revision 1.6 2001/07/29 05:36:14 richard
+# Cleanup of the link label generation.
+#
+# Revision 1.5 2001/07/29 04:05:37 richard
+# Added the fabricated property "id".
+#
# Revision 1.4 2001/07/27 06:25:35 richard
# Fixed some of the exceptions so they're the right type.
# Removed the str()-ification of node ids so we don't mask oopsy errors any
# Revision 1.1 2001/07/22 11:58:35 richard
# More Grande Splite
#
+#
+# vim: set filetype=python ts=4 sw=4 et si