index aebd2594fcde4a48d6f10051b35eae18346d73e4..e7d141c64c516dbfb1b49cb5c05b374140bdbf57 100644 (file)
-# $Id: rdbms_common.py,v 1.74 2004-01-20 05:55:51 richard Exp $
+# $Id: rdbms_common.py,v 1.75 2004-02-11 23:55:09 richard Exp $
''' Relational database (SQL) backend common code.
Basics:
honors column typing, since the initial databases don't (sqlite stores
everything as a string.)
'''
+__docformat__ = 'restructuredtext'
# standard python modules
import sys, os, time, re, errno, weakref, copy
raise KeyError, 'There is no class called "%s"'%classname
def clear(self):
- ''' Delete all database contents.
+ '''Delete all database contents.
- Note: I don't commit here, which is different behaviour to the
- "nuke from orbit" behaviour in the *dbms.
+ Note: I don't commit here, which is different behaviour to the
+ "nuke from orbit" behaviour in the dbs.
'''
if __debug__:
print >>hyperdb.DEBUG, 'clear', (self,)
WARNING: this method should never be used except in extremely rare
situations where there could never be links to the node being
deleted
+
WARNING: use retire() instead
+
WARNING: the properties of this node will not be available ever again
+
WARNING: really, use retire() instead
Well, I think that's enough warnings. This method exists mostly to
return self.key
def labelprop(self, default_to_id=0):
- ''' Return the property name for a label for the given node.
+ '''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
+
+ 1. key property
+ 2. "name" property
+ 3. "title" property
+ 4. first property from the sorted property name list
'''
k = self.getkey()
if k:
def filter(self, search_matches, filterspec, sort=(None,None),
group=(None,None)):
- ''' Return a list of the ids of the active nodes in this class that
- match the 'filter' spec, sorted by the group spec and then the
- sort spec
-
- "filterspec" is {propname: value(s)}
- "sort" and "group" are (dir, prop) where dir is '+', '-' or None
- and prop is a prop name or None
- "search_matches" is {nodeid: marker}
-
- The filter must match all properties specificed - but if the
- property value to match is a list, any one of the values in the
- list may match for that property to match.
+ '''Return a list of the ids of the active nodes in this class that
+ match the 'filter' spec, sorted by the group spec and then the
+ sort spec
+
+ "filterspec" is {propname: value(s)}
+
+ "sort" and "group" are (dir, prop) where dir is '+', '-' or None
+ and prop is a prop name or None
+
+ "search_matches" is {nodeid: marker}
+
+ The filter must match all properties specificed - but if the
+ property value to match is a list, any one of the values in the
+ list may match for that property to match.
'''
# just don't bother if the full-text search matched diddly
if search_matches == {}: