Code

extended date syntax to make range searches even more useful
[roundup.git] / roundup / hyperdb.py
index 65d07e9170c74153ab84809f6574bec920c5d604..4ab22268aafdf57cd4b7b98022dad397576246ea 100644 (file)
@@ -15,9 +15,9 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: hyperdb.py,v 1.82 2002-09-09 23:55:19 richard Exp $
+# $Id: hyperdb.py,v 1.87 2003-03-17 22:03:03 kedder Exp $
 
-__doc__ = """
+"""
 Hyperdatabase implementation, especially field types.
 """
 
@@ -416,6 +416,13 @@ class Class:
         """
         raise NotImplementedError
 
+    def restore(self, nodeid):
+        '''Restpre a retired node.
+
+        Make node available for all operations like it was before retirement.
+        '''
+        raise NotImplementedError
+    
     def is_retired(self, nodeid):
         '''Return true if the node is rerired
         '''
@@ -512,11 +519,20 @@ class Class:
         """
         raise NotImplementedError
 
-    def filter(self, search_matches, filterspec, sort, group, 
-            num_re = re.compile('^\d+$')):
+    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
+            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.
         '''
         raise NotImplementedError
 
@@ -552,6 +568,12 @@ class Class:
         '''
         raise NotImplementedError
 
+class FileClass:
+    ''' A class that requires the "content" property and stores it on
+        disk.
+    '''
+    pass
+
 class Node:
     ''' A convenience wrapper for the given node
     '''
@@ -573,6 +595,11 @@ class Node:
         return l
     def has_key(self, name):
         return self.cl.getprops().has_key(name)
+    def get(self, name, default=None): 
+        if self.has_key(name):
+            return self[name]
+        else:
+            return default
     def __getattr__(self, name):
         if self.__dict__.has_key(name):
             return self.__dict__[name]