Code

776704ca0bdfca7fcf4ebe08398fa3c1a6012e0d
[roundup.git] / roundup / hyperdb.py
1 #
2 # Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/)
3 # This module is free software, and you may redistribute it and/or modify
4 # under the same terms as Python, so long as this copyright message and
5 # disclaimer are retained in their original form.
6 #
7 # IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR
8 # DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
9 # OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE
10 # POSSIBILITY OF SUCH DAMAGE.
11 #
12 # BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14 # FOR A PARTICULAR PURPOSE.  THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
17
18 # $Id: hyperdb.py,v 1.66 2002-05-25 07:16:24 rochecompaan Exp $
20 __doc__ = """
21 Hyperdatabase implementation, especially field types.
22 """
24 # standard python modules
25 import re, string, weakref, os, time
27 # roundup modules
28 import date, password
30 # configure up the DEBUG and TRACE captures
31 class Sink:
32     def write(self, content):
33         pass
34 DEBUG = os.environ.get('HYPERDBDEBUG', '')
35 if DEBUG and __debug__:
36     DEBUG = open(DEBUG, 'a')
37 else:
38     DEBUG = Sink()
39 TRACE = os.environ.get('HYPERDBTRACE', '')
40 if TRACE and __debug__:
41     TRACE = open(TRACE, 'w')
42 else:
43     TRACE = Sink()
44 def traceMark():
45     print >>TRACE, '**MARK', time.ctime()
46 del Sink
48 #
49 # Types
50 #
51 class String:
52     """An object designating a String property."""
53     def __repr__(self):
54         ' more useful for dumps '
55         return '<%s>'%self.__class__
57 class Password:
58     """An object designating a Password property."""
59     def __repr__(self):
60         ' more useful for dumps '
61         return '<%s>'%self.__class__
63 class Date:
64     """An object designating a Date property."""
65     def __repr__(self):
66         ' more useful for dumps '
67         return '<%s>'%self.__class__
69 class Interval:
70     """An object designating an Interval property."""
71     def __repr__(self):
72         ' more useful for dumps '
73         return '<%s>'%self.__class__
75 class Link:
76     """An object designating a Link property that links to a
77        node in a specified class."""
78     def __init__(self, classname, do_journal='no'):
79         ''' Default is to not journal link and unlink events
80         '''
81         self.classname = classname
82         self.do_journal = do_journal == 'yes'
83     def __repr__(self):
84         ' more useful for dumps '
85         return '<%s to "%s">'%(self.__class__, self.classname)
87 class Multilink:
88     """An object designating a Multilink property that links
89        to nodes in a specified class.
91        "classname" indicates the class to link to
93        "do_journal" indicates whether the linked-to nodes should have
94                     'link' and 'unlink' events placed in their journal
95     """
96     def __init__(self, classname, do_journal='no'):
97         ''' Default is to not journal link and unlink events
98         '''
99         self.classname = classname
100         self.do_journal = do_journal == 'yes'
101     def __repr__(self):
102         ' more useful for dumps '
103         return '<%s to "%s">'%(self.__class__, self.classname)
105 class DatabaseError(ValueError):
106     '''Error to be raised when there is some problem in the database code
107     '''
108     pass
112 # the base Database class
114 class Database:
115     '''A database for storing records containing flexible data types.
117 This class defines a hyperdatabase storage layer, which the Classes use to
118 store their data.
121 Transactions
122 ------------
123 The Database should support transactions through the commit() and
124 rollback() methods. All other Database methods should be transaction-aware,
125 using data from the current transaction before looking up the database.
127 An implementation must provide an override for the get() method so that the
128 in-database value is returned in preference to the in-transaction value.
129 This is necessary to determine if any values have changed during a
130 transaction.
132 '''
134     # flag to set on retired entries
135     RETIRED_FLAG = '__hyperdb_retired'
137     # XXX deviates from spec: storagelocator is obtained from the config
138     def __init__(self, config, journaltag=None):
139         """Open a hyperdatabase given a specifier to some storage.
141         The 'storagelocator' is obtained from config.DATABASE.
142         The meaning of 'storagelocator' depends on the particular
143         implementation of the hyperdatabase.  It could be a file name,
144         a directory path, a socket descriptor for a connection to a
145         database over the network, etc.
147         The 'journaltag' is a token that will be attached to the journal
148         entries for any edits done on the database.  If 'journaltag' is
149         None, the database is opened in read-only mode: the Class.create(),
150         Class.set(), and Class.retire() methods are disabled.
151         """
152         raise NotImplementedError
154     def __getattr__(self, classname):
155         """A convenient way of calling self.getclass(classname)."""
156         raise NotImplementedError
158     def addclass(self, cl):
159         '''Add a Class to the hyperdatabase.
160         '''
161         raise NotImplementedError
163     def getclasses(self):
164         """Return a list of the names of all existing classes."""
165         raise NotImplementedError
167     def getclass(self, classname):
168         """Get the Class object representing a particular class.
170         If 'classname' is not a valid class name, a KeyError is raised.
171         """
172         raise NotImplementedError
174     def clear(self):
175         '''Delete all database contents.
176         '''
177         raise NotImplementedError
179     def getclassdb(self, classname, mode='r'):
180         '''Obtain a connection to the class db that will be used for
181            multiple actions.
182         '''
183         raise NotImplementedError
185     def addnode(self, classname, nodeid, node):
186         '''Add the specified node to its class's db.
187         '''
188         raise NotImplementedError
190     def serialise(self, classname, node):
191         '''Copy the node contents, converting non-marshallable data into
192            marshallable data.
193         '''
194         if __debug__:
195             print >>DEBUG, 'serialise', classname, node
196         properties = self.getclass(classname).getprops()
197         d = {}
198         for k, v in node.items():
199             # if the property doesn't exist, or is the "retired" flag then
200             # it won't be in the properties dict
201             if not properties.has_key(k):
202                 d[k] = v
203                 continue
205             # get the property spec
206             prop = properties[k]
208             if isinstance(prop, Password):
209                 d[k] = str(v)
210             elif isinstance(prop, Date) and v is not None:
211                 d[k] = v.get_tuple()
212             elif isinstance(prop, Interval) and v is not None:
213                 d[k] = v.get_tuple()
214             else:
215                 d[k] = v
216         return d
218     def setnode(self, classname, nodeid, node):
219         '''Change the specified node.
220         '''
221         raise NotImplementedError
223     def unserialise(self, classname, node):
224         '''Decode the marshalled node data
225         '''
226         if __debug__:
227             print >>DEBUG, 'unserialise', classname, node
228         properties = self.getclass(classname).getprops()
229         d = {}
230         for k, v in node.items():
231             # if the property doesn't exist, or is the "retired" flag then
232             # it won't be in the properties dict
233             if not properties.has_key(k):
234                 d[k] = v
235                 continue
237             # get the property spec
238             prop = properties[k]
240             if isinstance(prop, Date) and v is not None:
241                 d[k] = date.Date(v)
242             elif isinstance(prop, Interval) and v is not None:
243                 d[k] = date.Interval(v)
244             elif isinstance(prop, Password):
245                 p = password.Password()
246                 p.unpack(v)
247                 d[k] = p
248             else:
249                 d[k] = v
250         return d
252     def getnode(self, classname, nodeid, db=None, cache=1):
253         '''Get a node from the database.
254         '''
255         raise NotImplementedError
257     def hasnode(self, classname, nodeid, db=None):
258         '''Determine if the database has a given node.
259         '''
260         raise NotImplementedError
262     def countnodes(self, classname, db=None):
263         '''Count the number of nodes that exist for a particular Class.
264         '''
265         raise NotImplementedError
267     def getnodeids(self, classname, db=None):
268         '''Retrieve all the ids of the nodes for a particular Class.
269         '''
270         raise NotImplementedError
272     def storefile(self, classname, nodeid, property, content):
273         '''Store the content of the file in the database.
274         
275            The property may be None, in which case the filename does not
276            indicate which property is being saved.
277         '''
278         raise NotImplementedError
280     def getfile(self, classname, nodeid, property):
281         '''Store the content of the file in the database.
282         '''
283         raise NotImplementedError
285     def addjournal(self, classname, nodeid, action, params):
286         ''' Journal the Action
287         'action' may be:
289             'create' or 'set' -- 'params' is a dictionary of property values
290             'link' or 'unlink' -- 'params' is (classname, nodeid, propname)
291             'retire' -- 'params' is None
292         '''
293         raise NotImplementedError
295     def getjournal(self, classname, nodeid):
296         ''' get the journal for id
297         '''
298         raise NotImplementedError
300     def pack(self, pack_before):
301         ''' pack the database
302         '''
303         raise NotImplementedError
305     def commit(self):
306         ''' Commit the current transactions.
308         Save all data changed since the database was opened or since the
309         last commit() or rollback().
310         '''
311         raise NotImplementedError
313     def rollback(self):
314         ''' Reverse all actions from the current transaction.
316         Undo all the changes made since the database was opened or the last
317         commit() or rollback() was performed.
318         '''
319         raise NotImplementedError
321 _marker = []
323 # The base Class class
325 class Class:
326     """The handle to a particular class of nodes in a hyperdatabase."""
328     def __init__(self, db, classname, **properties):
329         """Create a new class with a given name and property specification.
331         'classname' must not collide with the name of an existing class,
332         or a ValueError is raised.  The keyword arguments in 'properties'
333         must map names to property objects, or a TypeError is raised.
334         """
335         self.classname = classname
336         self.properties = properties
337         self.db = weakref.proxy(db)       # use a weak ref to avoid circularity
338         self.key = ''
340         # do the db-related init stuff
341         db.addclass(self)
343     def __repr__(self):
344         '''Slightly more useful representation
345         '''
346         return '<hypderdb.Class "%s">'%self.classname
348     # Editing nodes:
350     def create(self, **propvalues):
351         """Create a new node of this class and return its id.
353         The keyword arguments in 'propvalues' map property names to values.
355         The values of arguments must be acceptable for the types of their
356         corresponding properties or a TypeError is raised.
357         
358         If this class has a key property, it must be present and its value
359         must not collide with other key strings or a ValueError is raised.
360         
361         Any other properties on this class that are missing from the
362         'propvalues' dictionary are set to None.
363         
364         If an id in a link or multilink property does not refer to a valid
365         node, an IndexError is raised.
366         """
367         if propvalues.has_key('id'):
368             raise KeyError, '"id" is reserved'
370         if self.db.journaltag is None:
371             raise DatabaseError, 'Database open read-only'
373         # new node's id
374         newid = self.db.newid(self.classname)
376         # validate propvalues
377         num_re = re.compile('^\d+$')
378         for key, value in propvalues.items():
379             if key == self.key:
380                 try:
381                     self.lookup(value)
382                 except KeyError:
383                     pass
384                 else:
385                     raise ValueError, 'node with key "%s" exists'%value
387             # try to handle this property
388             try:
389                 prop = self.properties[key]
390             except KeyError:
391                 raise KeyError, '"%s" has no property "%s"'%(self.classname,
392                     key)
394             if isinstance(prop, Link):
395                 if type(value) != type(''):
396                     raise ValueError, 'link value must be String'
397                 link_class = self.properties[key].classname
398                 # if it isn't a number, it's a key
399                 if not num_re.match(value):
400                     try:
401                         value = self.db.classes[link_class].lookup(value)
402                     except (TypeError, KeyError):
403                         raise IndexError, 'new property "%s": %s not a %s'%(
404                             key, value, link_class)
405                 elif not self.db.hasnode(link_class, value):
406                     raise IndexError, '%s has no node %s'%(link_class, value)
408                 # save off the value
409                 propvalues[key] = value
411                 # register the link with the newly linked node
412                 if self.properties[key].do_journal:
413                     self.db.addjournal(link_class, value, 'link',
414                         (self.classname, newid, key))
416             elif isinstance(prop, Multilink):
417                 if type(value) != type([]):
418                     raise TypeError, 'new property "%s" not a list of ids'%key
419                 link_class = self.properties[key].classname
420                 l = []
421                 for entry in value:
422                     if type(entry) != type(''):
423                         raise ValueError, 'link value must be String'
424                     # if it isn't a number, it's a key
425                     if not num_re.match(entry):
426                         try:
427                             entry = self.db.classes[link_class].lookup(entry)
428                         except (TypeError, KeyError):
429                             raise IndexError, 'new property "%s": %s not a %s'%(
430                                 key, entry, self.properties[key].classname)
431                     l.append(entry)
432                 value = l
433                 propvalues[key] = value
435                 # handle additions
436                 for id in value:
437                     if not self.db.hasnode(link_class, id):
438                         raise IndexError, '%s has no node %s'%(link_class, id)
439                     # register the link with the newly linked node
440                     if self.properties[key].do_journal:
441                         self.db.addjournal(link_class, id, 'link',
442                             (self.classname, newid, key))
444             elif isinstance(prop, String):
445                 if type(value) != type(''):
446                     raise TypeError, 'new property "%s" not a string'%key
448             elif isinstance(prop, Password):
449                 if not isinstance(value, password.Password):
450                     raise TypeError, 'new property "%s" not a Password'%key
452             elif isinstance(prop, Date):
453                 if value is not None and not isinstance(value, date.Date):
454                     raise TypeError, 'new property "%s" not a Date'%key
456             elif isinstance(prop, Interval):
457                 if value is not None and not isinstance(value, date.Interval):
458                     raise TypeError, 'new property "%s" not an Interval'%key
460         # make sure there's data where there needs to be
461         for key, prop in self.properties.items():
462             if propvalues.has_key(key):
463                 continue
464             if key == self.key:
465                 raise ValueError, 'key property "%s" is required'%key
466             if isinstance(prop, Multilink):
467                 propvalues[key] = []
468             else:
469                 # TODO: None isn't right here, I think...
470                 propvalues[key] = None
472         # done
473         self.db.addnode(self.classname, newid, propvalues)
474         self.db.addjournal(self.classname, newid, 'create', propvalues)
475         return newid
477     def get(self, nodeid, propname, default=_marker, cache=1):
478         """Get the value of a property on an existing node of this class.
480         'nodeid' must be the id of an existing node of this class or an
481         IndexError is raised.  'propname' must be the name of a property
482         of this class or a KeyError is raised.
484         'cache' indicates whether the transaction cache should be queried
485         for the node. If the node has been modified and you need to
486         determine what its values prior to modification are, you need to
487         set cache=0.
488         """
489         if propname == 'id':
490             return nodeid
492         # get the property (raises KeyErorr if invalid)
493         prop = self.properties[propname]
495         # get the node's dict
496         d = self.db.getnode(self.classname, nodeid, cache=cache)
498         if not d.has_key(propname):
499             if default is _marker:
500                 if isinstance(prop, Multilink):
501                     return []
502                 else:
503                     # TODO: None isn't right here, I think...
504                     return None
505             else:
506                 return default
508         return d[propname]
510     # XXX not in spec
511     def getnode(self, nodeid, cache=1):
512         ''' Return a convenience wrapper for the node.
514         'nodeid' must be the id of an existing node of this class or an
515         IndexError is raised.
517         'cache' indicates whether the transaction cache should be queried
518         for the node. If the node has been modified and you need to
519         determine what its values prior to modification are, you need to
520         set cache=0.
521         '''
522         return Node(self, nodeid, cache=cache)
524     def set(self, nodeid, **propvalues):
525         """Modify a property on an existing node of this class.
526         
527         'nodeid' must be the id of an existing node of this class or an
528         IndexError is raised.
530         Each key in 'propvalues' must be the name of a property of this
531         class or a KeyError is raised.
533         All values in 'propvalues' must be acceptable types for their
534         corresponding properties or a TypeError is raised.
536         If the value of the key property is set, it must not collide with
537         other key strings or a ValueError is raised.
539         If the value of a Link or Multilink property contains an invalid
540         node id, a ValueError is raised.
541         """
542         if not propvalues:
543             return
545         if propvalues.has_key('id'):
546             raise KeyError, '"id" is reserved'
548         if self.db.journaltag is None:
549             raise DatabaseError, 'Database open read-only'
551         node = self.db.getnode(self.classname, nodeid)
552         if node.has_key(self.db.RETIRED_FLAG):
553             raise IndexError
554         num_re = re.compile('^\d+$')
555         for key, value in propvalues.items():
556             # check to make sure we're not duplicating an existing key
557             if key == self.key and node[key] != value:
558                 try:
559                     self.lookup(value)
560                 except KeyError:
561                     pass
562                 else:
563                     raise ValueError, 'node with key "%s" exists'%value
565             # this will raise the KeyError if the property isn't valid
566             # ... we don't use getprops() here because we only care about
567             # the writeable properties.
568             prop = self.properties[key]
570             # if the value's the same as the existing value, no sense in
571             # doing anything
572             if node.has_key(key) and value == node[key]:
573                 del propvalues[key]
574                 continue
576             # do stuff based on the prop type
577             if isinstance(prop, Link):
578                 link_class = self.properties[key].classname
579                 # if it isn't a number, it's a key
580                 if type(value) != type(''):
581                     raise ValueError, 'link value must be String'
582                 if not num_re.match(value):
583                     try:
584                         value = self.db.classes[link_class].lookup(value)
585                     except (TypeError, KeyError):
586                         raise IndexError, 'new property "%s": %s not a %s'%(
587                             key, value, self.properties[key].classname)
589                 if not self.db.hasnode(link_class, value):
590                     raise IndexError, '%s has no node %s'%(link_class, value)
592                 if self.properties[key].do_journal:
593                     # register the unlink with the old linked node
594                     if node[key] is not None:
595                         self.db.addjournal(link_class, node[key], 'unlink',
596                             (self.classname, nodeid, key))
598                     # register the link with the newly linked node
599                     if value is not None:
600                         self.db.addjournal(link_class, value, 'link',
601                             (self.classname, nodeid, key))
603             elif isinstance(prop, Multilink):
604                 if type(value) != type([]):
605                     raise TypeError, 'new property "%s" not a list of ids'%key
606                 link_class = self.properties[key].classname
607                 l = []
608                 for entry in value:
609                     # if it isn't a number, it's a key
610                     if type(entry) != type(''):
611                         raise ValueError, 'new property "%s" link value ' \
612                             'must be a string'%key
613                     if not num_re.match(entry):
614                         try:
615                             entry = self.db.classes[link_class].lookup(entry)
616                         except (TypeError, KeyError):
617                             raise IndexError, 'new property "%s": %s not a %s'%(
618                                 key, entry, self.properties[key].classname)
619                     l.append(entry)
620                 value = l
621                 propvalues[key] = value
623                 # handle removals
624                 if node.has_key(key):
625                     l = node[key]
626                 else:
627                     l = []
628                 for id in l[:]:
629                     if id in value:
630                         continue
631                     # register the unlink with the old linked node
632                     if self.properties[key].do_journal:
633                         self.db.addjournal(link_class, id, 'unlink',
634                             (self.classname, nodeid, key))
635                     l.remove(id)
637                 # handle additions
638                 for id in value:
639                     if not self.db.hasnode(link_class, id):
640                         raise IndexError, '%s has no node %s'%(
641                             link_class, id)
642                     if id in l:
643                         continue
644                     # register the link with the newly linked node
645                     if self.properties[key].do_journal:
646                         self.db.addjournal(link_class, id, 'link',
647                             (self.classname, nodeid, key))
648                     l.append(id)
650             elif isinstance(prop, String):
651                 if value is not None and type(value) != type(''):
652                     raise TypeError, 'new property "%s" not a string'%key
654             elif isinstance(prop, Password):
655                 if not isinstance(value, password.Password):
656                     raise TypeError, 'new property "%s" not a Password'% key
657                 propvalues[key] = value
659             elif value is not None and isinstance(prop, Date):
660                 if not isinstance(value, date.Date):
661                     raise TypeError, 'new property "%s" not a Date'% key
662                 propvalues[key] = value
664             elif value is not None and isinstance(prop, Interval):
665                 if not isinstance(value, date.Interval):
666                     raise TypeError, 'new property "%s" not an Interval'% key
667                 propvalues[key] = value
669             node[key] = value
671         # nothing to do?
672         if not propvalues:
673             return
675         # do the set, and journal it
676         self.db.setnode(self.classname, nodeid, node)
677         self.db.addjournal(self.classname, nodeid, 'set', propvalues)
679     def retire(self, nodeid):
680         """Retire a node.
681         
682         The properties on the node remain available from the get() method,
683         and the node's id is never reused.
684         
685         Retired nodes are not returned by the find(), list(), or lookup()
686         methods, and other nodes may reuse the values of their key properties.
687         """
688         if self.db.journaltag is None:
689             raise DatabaseError, 'Database open read-only'
690         node = self.db.getnode(self.classname, nodeid)
691         node[self.db.RETIRED_FLAG] = 1
692         self.db.setnode(self.classname, nodeid, node)
693         self.db.addjournal(self.classname, nodeid, 'retired', None)
695     def history(self, nodeid):
696         """Retrieve the journal of edits on a particular node.
698         'nodeid' must be the id of an existing node of this class or an
699         IndexError is raised.
701         The returned list contains tuples of the form
703             (date, tag, action, params)
705         'date' is a Timestamp object specifying the time of the change and
706         'tag' is the journaltag specified when the database was opened.
707         """
708         return self.db.getjournal(self.classname, nodeid)
710     # Locating nodes:
711     def hasnode(self, nodeid):
712         '''Determine if the given nodeid actually exists
713         '''
714         return self.db.hasnode(self.classname, nodeid)
716     def setkey(self, propname):
717         """Select a String property of this class to be the key property.
719         'propname' must be the name of a String property of this class or
720         None, or a TypeError is raised.  The values of the key property on
721         all existing nodes must be unique or a ValueError is raised.
722         """
723         # TODO: validate that the property is a String!
724         self.key = propname
726     def getkey(self):
727         """Return the name of the key property for this class or None."""
728         return self.key
730     def labelprop(self, default_to_id=0):
731         ''' Return the property name for a label for the given node.
733         This method attempts to generate a consistent label for the node.
734         It tries the following in order:
735             1. key property
736             2. "name" property
737             3. "title" property
738             4. first property from the sorted property name list
739         '''
740         k = self.getkey()
741         if  k:
742             return k
743         props = self.getprops()
744         if props.has_key('name'):
745             return 'name'
746         elif props.has_key('title'):
747             return 'title'
748         if default_to_id:
749             return 'id'
750         props = props.keys()
751         props.sort()
752         return props[0]
754     # TODO: set up a separate index db file for this? profile?
755     def lookup(self, keyvalue):
756         """Locate a particular node by its key property and return its id.
758         If this class has no key property, a TypeError is raised.  If the
759         'keyvalue' matches one of the values for the key property among
760         the nodes in this class, the matching node's id is returned;
761         otherwise a KeyError is raised.
762         """
763         cldb = self.db.getclassdb(self.classname)
764         for nodeid in self.db.getnodeids(self.classname, cldb):
765             node = self.db.getnode(self.classname, nodeid, cldb)
766             if node.has_key(self.db.RETIRED_FLAG):
767                 continue
768             if node[self.key] == keyvalue:
769                 return nodeid
770         raise KeyError, keyvalue
772     # XXX: change from spec - allows multiple props to match
773     def find(self, **propspec):
774         """Get the ids of nodes in this class which link to a given node.
776         'propspec' consists of keyword args propname=nodeid   
777           'propname' must be the name of a property in this class, or a
778             KeyError is raised.  That property must be a Link or Multilink
779             property, or a TypeError is raised.
781           'nodeid' must be the id of an existing node in the class linked
782             to by the given property, or an IndexError is raised.
783         """
784         propspec = propspec.items()
785         for propname, nodeid in propspec:
786             # check the prop is OK
787             prop = self.properties[propname]
788             if not isinstance(prop, Link) and not isinstance(prop, Multilink):
789                 raise TypeError, "'%s' not a Link/Multilink property"%propname
790             if not self.db.hasnode(prop.classname, nodeid):
791                 raise ValueError, '%s has no node %s'%(prop.classname, nodeid)
793         # ok, now do the find
794         cldb = self.db.getclassdb(self.classname)
795         l = []
796         for id in self.db.getnodeids(self.classname, cldb):
797             node = self.db.getnode(self.classname, id, cldb)
798             if node.has_key(self.db.RETIRED_FLAG):
799                 continue
800             for propname, nodeid in propspec:
801                 property = node[propname]
802                 if isinstance(prop, Link) and nodeid == property:
803                     l.append(id)
804                 elif isinstance(prop, Multilink) and nodeid in property:
805                     l.append(id)
806         return l
808     def stringFind(self, **requirements):
809         """Locate a particular node by matching a set of its String
810         properties in a caseless search.
812         If the property is not a String property, a TypeError is raised.
813         
814         The return is a list of the id of all nodes that match.
815         """
816         for propname in requirements.keys():
817             prop = self.properties[propname]
818             if isinstance(not prop, String):
819                 raise TypeError, "'%s' not a String property"%propname
820             requirements[propname] = requirements[propname].lower()
821         l = []
822         cldb = self.db.getclassdb(self.classname)
823         for nodeid in self.db.getnodeids(self.classname, cldb):
824             node = self.db.getnode(self.classname, nodeid, cldb)
825             if node.has_key(self.db.RETIRED_FLAG):
826                 continue
827             for key, value in requirements.items():
828                 if node[key] and node[key].lower() != value:
829                     break
830             else:
831                 l.append(nodeid)
832         return l
834     def list(self):
835         """Return a list of the ids of the active nodes in this class."""
836         l = []
837         cn = self.classname
838         cldb = self.db.getclassdb(cn)
839         for nodeid in self.db.getnodeids(cn, cldb):
840             node = self.db.getnode(cn, nodeid, cldb)
841             if node.has_key(self.db.RETIRED_FLAG):
842                 continue
843             l.append(nodeid)
844         l.sort()
845         return l
847     # XXX not in spec
848     def filter(self, search_matches, filterspec, sort, group, 
849             num_re = re.compile('^\d+$')):
850         ''' Return a list of the ids of the active nodes in this class that
851             match the 'filter' spec, sorted by the group spec and then the
852             sort spec
853         '''
854         cn = self.classname
856         # optimise filterspec
857         l = []
858         props = self.getprops()
859         for k, v in filterspec.items():
860             propclass = props[k]
861             if isinstance(propclass, Link):
862                 if type(v) is not type([]):
863                     v = [v]
864                 # replace key values with node ids
865                 u = []
866                 link_class =  self.db.classes[propclass.classname]
867                 for entry in v:
868                     if entry == '-1': entry = None
869                     elif not num_re.match(entry):
870                         try:
871                             entry = link_class.lookup(entry)
872                         except (TypeError,KeyError):
873                             raise ValueError, 'property "%s": %s not a %s'%(
874                                 k, entry, self.properties[k].classname)
875                     u.append(entry)
877                 l.append((0, k, u))
878             elif isinstance(propclass, Multilink):
879                 if type(v) is not type([]):
880                     v = [v]
881                 # replace key values with node ids
882                 u = []
883                 link_class =  self.db.classes[propclass.classname]
884                 for entry in v:
885                     if not num_re.match(entry):
886                         try:
887                             entry = link_class.lookup(entry)
888                         except (TypeError,KeyError):
889                             raise ValueError, 'new property "%s": %s not a %s'%(
890                                 k, entry, self.properties[k].classname)
891                     u.append(entry)
892                 l.append((1, k, u))
893             elif isinstance(propclass, String):
894                 # simple glob searching
895                 v = re.sub(r'([\|\{\}\\\.\+\[\]\(\)])', r'\\\1', v)
896                 v = v.replace('?', '.')
897                 v = v.replace('*', '.*?')
898                 l.append((2, k, re.compile(v, re.I)))
899             else:
900                 l.append((6, k, v))
901         filterspec = l
903         # now, find all the nodes that are active and pass filtering
904         l = []
905         cldb = self.db.getclassdb(cn)
906         for nodeid in self.db.getnodeids(cn, cldb):
907             node = self.db.getnode(cn, nodeid, cldb)
908             if node.has_key(self.db.RETIRED_FLAG):
909                 continue
910             # apply filter
911             for t, k, v in filterspec:
912                 # this node doesn't have this property, so reject it
913                 if not node.has_key(k): break
915                 if t == 0 and node[k] not in v:
916                     # link - if this node'd property doesn't appear in the
917                     # filterspec's nodeid list, skip it
918                     break
919                 elif t == 1:
920                     # multilink - if any of the nodeids required by the
921                     # filterspec aren't in this node's property, then skip
922                     # it
923                     for value in v:
924                         if value not in node[k]:
925                             break
926                     else:
927                         continue
928                     break
929                 elif t == 2 and (node[k] is None or not v.search(node[k])):
930                     # RE search
931                     break
932                 elif t == 6 and node[k] != v:
933                     # straight value comparison for the other types
934                     break
935             else:
936                 l.append((nodeid, node))
937         l.sort()
939         # filter based on full text search
940         if search_matches is not None:
941             k = []
942             l_debug = []
943             for v in l:
944                 l_debug.append(v[0])
945                 if search_matches.has_key(v[0]):
946                     k.append(v)
947             l = k
949         # optimise sort
950         m = []
951         for entry in sort:
952             if entry[0] != '-':
953                 m.append(('+', entry))
954             else:
955                 m.append((entry[0], entry[1:]))
956         sort = m
958         # optimise group
959         m = []
960         for entry in group:
961             if entry[0] != '-':
962                 m.append(('+', entry))
963             else:
964                 m.append((entry[0], entry[1:]))
965         group = m
966         # now, sort the result
967         def sortfun(a, b, sort=sort, group=group, properties=self.getprops(),
968                 db = self.db, cl=self):
969             a_id, an = a
970             b_id, bn = b
971             # sort by group and then sort
972             for list in group, sort:
973                 for dir, prop in list:
974                     # sorting is class-specific
975                     propclass = properties[prop]
977                     # handle the properties that might be "faked"
978                     # also, handle possible missing properties
979                     try:
980                         if not an.has_key(prop):
981                             an[prop] = cl.get(a_id, prop)
982                         av = an[prop]
983                     except KeyError:
984                         # the node doesn't have a value for this property
985                         if isinstance(propclass, Multilink): av = []
986                         else: av = ''
987                     try:
988                         if not bn.has_key(prop):
989                             bn[prop] = cl.get(b_id, prop)
990                         bv = bn[prop]
991                     except KeyError:
992                         # the node doesn't have a value for this property
993                         if isinstance(propclass, Multilink): bv = []
994                         else: bv = ''
996                     # String and Date values are sorted in the natural way
997                     if isinstance(propclass, String):
998                         # clean up the strings
999                         if av and av[0] in string.uppercase:
1000                             av = an[prop] = av.lower()
1001                         if bv and bv[0] in string.uppercase:
1002                             bv = bn[prop] = bv.lower()
1003                     if (isinstance(propclass, String) or
1004                             isinstance(propclass, Date)):
1005                         # it might be a string that's really an integer
1006                         try:
1007                             av = int(av)
1008                             bv = int(bv)
1009                         except:
1010                             pass
1011                         if dir == '+':
1012                             r = cmp(av, bv)
1013                             if r != 0: return r
1014                         elif dir == '-':
1015                             r = cmp(bv, av)
1016                             if r != 0: return r
1018                     # Link properties are sorted according to the value of
1019                     # the "order" property on the linked nodes if it is
1020                     # present; or otherwise on the key string of the linked
1021                     # nodes; or finally on  the node ids.
1022                     elif isinstance(propclass, Link):
1023                         link = db.classes[propclass.classname]
1024                         if av is None and bv is not None: return -1
1025                         if av is not None and bv is None: return 1
1026                         if av is None and bv is None: continue
1027                         if link.getprops().has_key('order'):
1028                             if dir == '+':
1029                                 r = cmp(link.get(av, 'order'),
1030                                     link.get(bv, 'order'))
1031                                 if r != 0: return r
1032                             elif dir == '-':
1033                                 r = cmp(link.get(bv, 'order'),
1034                                     link.get(av, 'order'))
1035                                 if r != 0: return r
1036                         elif link.getkey():
1037                             key = link.getkey()
1038                             if dir == '+':
1039                                 r = cmp(link.get(av, key), link.get(bv, key))
1040                                 if r != 0: return r
1041                             elif dir == '-':
1042                                 r = cmp(link.get(bv, key), link.get(av, key))
1043                                 if r != 0: return r
1044                         else:
1045                             if dir == '+':
1046                                 r = cmp(av, bv)
1047                                 if r != 0: return r
1048                             elif dir == '-':
1049                                 r = cmp(bv, av)
1050                                 if r != 0: return r
1052                     # Multilink properties are sorted according to how many
1053                     # links are present.
1054                     elif isinstance(propclass, Multilink):
1055                         if dir == '+':
1056                             r = cmp(len(av), len(bv))
1057                             if r != 0: return r
1058                         elif dir == '-':
1059                             r = cmp(len(bv), len(av))
1060                             if r != 0: return r
1061                 # end for dir, prop in list:
1062             # end for list in sort, group:
1063             # if all else fails, compare the ids
1064             return cmp(a[0], b[0])
1066         l.sort(sortfun)
1067         return [i[0] for i in l]
1069     def count(self):
1070         """Get the number of nodes in this class.
1072         If the returned integer is 'numnodes', the ids of all the nodes
1073         in this class run from 1 to numnodes, and numnodes+1 will be the
1074         id of the next node to be created in this class.
1075         """
1076         return self.db.countnodes(self.classname)
1078     # Manipulating properties:
1080     def getprops(self, protected=1):
1081         """Return a dictionary mapping property names to property objects.
1082            If the "protected" flag is true, we include protected properties -
1083            those which may not be modified."""
1084         d = self.properties.copy()
1085         if protected:
1086             d['id'] = String()
1087         return d
1089     def addprop(self, **properties):
1090         """Add properties to this class.
1092         The keyword arguments in 'properties' must map names to property
1093         objects, or a TypeError is raised.  None of the keys in 'properties'
1094         may collide with the names of existing properties, or a ValueError
1095         is raised before any properties have been added.
1096         """
1097         for key in properties.keys():
1098             if self.properties.has_key(key):
1099                 raise ValueError, key
1100         self.properties.update(properties)
1102 # XXX not in spec
1103 class Node:
1104     ''' A convenience wrapper for the given node
1105     '''
1106     def __init__(self, cl, nodeid, cache=1):
1107         self.__dict__['cl'] = cl
1108         self.__dict__['nodeid'] = nodeid
1109         self.__dict__['cache'] = cache
1110     def keys(self, protected=1):
1111         return self.cl.getprops(protected=protected).keys()
1112     def values(self, protected=1):
1113         l = []
1114         for name in self.cl.getprops(protected=protected).keys():
1115             l.append(self.cl.get(self.nodeid, name, cache=self.cache))
1116         return l
1117     def items(self, protected=1):
1118         l = []
1119         for name in self.cl.getprops(protected=protected).keys():
1120             l.append((name, self.cl.get(self.nodeid, name, cache=self.cache)))
1121         return l
1122     def has_key(self, name):
1123         return self.cl.getprops().has_key(name)
1124     def __getattr__(self, name):
1125         if self.__dict__.has_key(name):
1126             return self.__dict__[name]
1127         try:
1128             return self.cl.get(self.nodeid, name, cache=self.cache)
1129         except KeyError, value:
1130             # we trap this but re-raise it as AttributeError - all other
1131             # exceptions should pass through untrapped
1132             pass
1133         # nope, no such attribute
1134         raise AttributeError, str(value)
1135     def __getitem__(self, name):
1136         return self.cl.get(self.nodeid, name, cache=self.cache)
1137     def __setattr__(self, name, value):
1138         try:
1139             return self.cl.set(self.nodeid, **{name: value})
1140         except KeyError, value:
1141             raise AttributeError, str(value)
1142     def __setitem__(self, name, value):
1143         self.cl.set(self.nodeid, **{name: value})
1144     def history(self):
1145         return self.cl.history(self.nodeid)
1146     def retire(self):
1147         return self.cl.retire(self.nodeid)
1150 def Choice(name, db, *options):
1151     '''Quick helper to create a simple class with choices
1152     '''
1153     cl = Class(db, name, name=String(), order=String())
1154     for i in range(len(options)):
1155         cl.create(name=options[i], order=i)
1156     return hyperdb.Link(name)
1159 # $Log: not supported by cvs2svn $
1160 # Revision 1.65  2002/05/22 04:12:05  richard
1161 #  . applied patch #558876 ] cgi client customization
1162 #    ... with significant additions and modifications ;)
1163 #    - extended handling of ML assignedto to all places it's handled
1164 #    - added more NotFound info
1166 # Revision 1.64  2002/05/15 06:21:21  richard
1167 #  . node caching now works, and gives a small boost in performance
1169 # As a part of this, I cleaned up the DEBUG output and implemented TRACE
1170 # output (HYPERDBTRACE='file to trace to') with checkpoints at the start of
1171 # CGI requests. Run roundup with python -O to skip all the DEBUG/TRACE stuff
1172 # (using if __debug__ which is compiled out with -O)
1174 # Revision 1.63  2002/04/15 23:25:15  richard
1175 # . node ids are now generated from a lockable store - no more race conditions
1177 # We're using the portalocker code by Jonathan Feinberg that was contributed
1178 # to the ASPN Python cookbook. This gives us locking across Unix and Windows.
1180 # Revision 1.62  2002/04/03 07:05:50  richard
1181 # d'oh! killed retirement of nodes :(
1182 # all better now...
1184 # Revision 1.61  2002/04/03 06:11:51  richard
1185 # Fix for old databases that contain properties that don't exist any more.
1187 # Revision 1.60  2002/04/03 05:54:31  richard
1188 # Fixed serialisation problem by moving the serialisation step out of the
1189 # hyperdb.Class (get, set) into the hyperdb.Database.
1191 # Also fixed htmltemplate after the showid changes I made yesterday.
1193 # Unit tests for all of the above written.
1195 # Revision 1.59.2.2  2002/04/20 13:23:33  rochecompaan
1196 # We now have a separate search page for nodes.  Search links for
1197 # different classes can be customized in instance_config similar to
1198 # index links.
1200 # Revision 1.59.2.1  2002/04/19 19:54:42  rochecompaan
1201 # cgi_client.py
1202 #     removed search link for the time being
1203 #     moved rendering of matches to htmltemplate
1204 # hyperdb.py
1205 #     filtering of nodes on full text search incorporated in filter method
1206 # roundupdb.py
1207 #     added paramater to call of filter method
1208 # roundup_indexer.py
1209 #     added search method to RoundupIndexer class
1211 # Revision 1.59  2002/03/12 22:52:26  richard
1212 # more pychecker warnings removed
1214 # Revision 1.58  2002/02/27 03:23:16  richard
1215 # Ran it through pychecker, made fixes
1217 # Revision 1.57  2002/02/20 05:23:24  richard
1218 # Didn't accomodate new values for new properties
1220 # Revision 1.56  2002/02/20 05:05:28  richard
1221 #  . Added simple editing for classes that don't define a templated interface.
1222 #    - access using the admin "class list" interface
1223 #    - limited to admin-only
1224 #    - requires the csv module from object-craft (url given if it's missing)
1226 # Revision 1.55  2002/02/15 07:27:12  richard
1227 # Oops, precedences around the way w0rng.
1229 # Revision 1.54  2002/02/15 07:08:44  richard
1230 #  . Alternate email addresses are now available for users. See the MIGRATION
1231 #    file for info on how to activate the feature.
1233 # Revision 1.53  2002/01/22 07:21:13  richard
1234 # . fixed back_bsddb so it passed the journal tests
1236 # ... it didn't seem happy using the back_anydbm _open method, which is odd.
1237 # Yet another occurrance of whichdb not being able to recognise older bsddb
1238 # databases. Yadda yadda. Made the HYPERDBDEBUG stuff more sane in the
1239 # process.
1241 # Revision 1.52  2002/01/21 16:33:19  rochecompaan
1242 # You can now use the roundup-admin tool to pack the database
1244 # Revision 1.51  2002/01/21 03:01:29  richard
1245 # brief docco on the do_journal argument
1247 # Revision 1.50  2002/01/19 13:16:04  rochecompaan
1248 # Journal entries for link and multilink properties can now be switched on
1249 # or off.
1251 # Revision 1.49  2002/01/16 07:02:57  richard
1252 #  . lots of date/interval related changes:
1253 #    - more relaxed date format for input
1255 # Revision 1.48  2002/01/14 06:32:34  richard
1256 #  . #502951 ] adding new properties to old database
1258 # Revision 1.47  2002/01/14 02:20:15  richard
1259 #  . changed all config accesses so they access either the instance or the
1260 #    config attriubute on the db. This means that all config is obtained from
1261 #    instance_config instead of the mish-mash of classes. This will make
1262 #    switching to a ConfigParser setup easier too, I hope.
1264 # At a minimum, this makes migration a _little_ easier (a lot easier in the
1265 # 0.5.0 switch, I hope!)
1267 # Revision 1.46  2002/01/07 10:42:23  richard
1268 # oops
1270 # Revision 1.45  2002/01/02 04:18:17  richard
1271 # hyperdb docstrings
1273 # Revision 1.44  2002/01/02 02:31:38  richard
1274 # Sorry for the huge checkin message - I was only intending to implement #496356
1275 # but I found a number of places where things had been broken by transactions:
1276 #  . modified ROUNDUPDBSENDMAILDEBUG to be SENDMAILDEBUG and hold a filename
1277 #    for _all_ roundup-generated smtp messages to be sent to.
1278 #  . the transaction cache had broken the roundupdb.Class set() reactors
1279 #  . newly-created author users in the mailgw weren't being committed to the db
1281 # Stuff that made it into CHANGES.txt (ie. the stuff I was actually working
1282 # on when I found that stuff :):
1283 #  . #496356 ] Use threading in messages
1284 #  . detectors were being registered multiple times
1285 #  . added tests for mailgw
1286 #  . much better attaching of erroneous messages in the mail gateway
1288 # Revision 1.43  2001/12/20 06:13:24  rochecompaan
1289 # Bugs fixed:
1290 #   . Exception handling in hyperdb for strings-that-look-like numbers got
1291 #     lost somewhere
1292 #   . Internet Explorer submits full path for filename - we now strip away
1293 #     the path
1294 # Features added:
1295 #   . Link and multilink properties are now displayed sorted in the cgi
1296 #     interface
1298 # Revision 1.42  2001/12/16 10:53:37  richard
1299 # take a copy of the node dict so that the subsequent set
1300 # operation doesn't modify the oldvalues structure
1302 # Revision 1.41  2001/12/15 23:47:47  richard
1303 # Cleaned up some bare except statements
1305 # Revision 1.40  2001/12/14 23:42:57  richard
1306 # yuck, a gdbm instance tests false :(
1307 # I've left the debugging code in - it should be removed one day if we're ever
1308 # _really_ anal about performace :)
1310 # Revision 1.39  2001/12/02 05:06:16  richard
1311 # . We now use weakrefs in the Classes to keep the database reference, so
1312 #   the close() method on the database is no longer needed.
1313 #   I bumped the minimum python requirement up to 2.1 accordingly.
1314 # . #487480 ] roundup-server
1315 # . #487476 ] INSTALL.txt
1317 # I also cleaned up the change message / post-edit stuff in the cgi client.
1318 # There's now a clearly marked "TODO: append the change note" where I believe
1319 # the change note should be added there. The "changes" list will obviously
1320 # have to be modified to be a dict of the changes, or somesuch.
1322 # More testing needed.
1324 # Revision 1.38  2001/12/01 07:17:50  richard
1325 # . We now have basic transaction support! Information is only written to
1326 #   the database when the commit() method is called. Only the anydbm
1327 #   backend is modified in this way - neither of the bsddb backends have been.
1328 #   The mail, admin and cgi interfaces all use commit (except the admin tool
1329 #   doesn't have a commit command, so interactive users can't commit...)
1330 # . Fixed login/registration forwarding the user to the right page (or not,
1331 #   on a failure)
1333 # Revision 1.37  2001/11/28 21:55:35  richard
1334 #  . login_action and newuser_action return values were being ignored
1335 #  . Woohoo! Found that bloody re-login bug that was killing the mail
1336 #    gateway.
1337 #  (also a minor cleanup in hyperdb)
1339 # Revision 1.36  2001/11/27 03:16:09  richard
1340 # Another place that wasn't handling missing properties.
1342 # Revision 1.35  2001/11/22 15:46:42  jhermann
1343 # Added module docstrings to all modules.
1345 # Revision 1.34  2001/11/21 04:04:43  richard
1346 # *sigh* more missing value handling
1348 # Revision 1.33  2001/11/21 03:40:54  richard
1349 # more new property handling
1351 # Revision 1.32  2001/11/21 03:11:28  richard
1352 # Better handling of new properties.
1354 # Revision 1.31  2001/11/12 22:01:06  richard
1355 # Fixed issues with nosy reaction and author copies.
1357 # Revision 1.30  2001/11/09 10:11:08  richard
1358 #  . roundup-admin now handles all hyperdb exceptions
1360 # Revision 1.29  2001/10/27 00:17:41  richard
1361 # Made Class.stringFind() do caseless matching.
1363 # Revision 1.28  2001/10/21 04:44:50  richard
1364 # bug #473124: UI inconsistency with Link fields.
1365 #    This also prompted me to fix a fairly long-standing usability issue -
1366 #    that of being able to turn off certain filters.
1368 # Revision 1.27  2001/10/20 23:44:27  richard
1369 # Hyperdatabase sorts strings-that-look-like-numbers as numbers now.
1371 # Revision 1.26  2001/10/16 03:48:01  richard
1372 # admin tool now complains if a "find" is attempted with a non-link property.
1374 # Revision 1.25  2001/10/11 00:17:51  richard
1375 # Reverted a change in hyperdb so the default value for missing property
1376 # values in a create() is None and not '' (the empty string.) This obviously
1377 # breaks CSV import/export - the string 'None' will be created in an
1378 # export/import operation.
1380 # Revision 1.24  2001/10/10 03:54:57  richard
1381 # Added database importing and exporting through CSV files.
1382 # Uses the csv module from object-craft for exporting if it's available.
1383 # Requires the csv module for importing.
1385 # Revision 1.23  2001/10/09 23:58:10  richard
1386 # Moved the data stringification up into the hyperdb.Class class' get, set
1387 # and create methods. This means that the data is also stringified for the
1388 # journal call, and removes duplication of code from the backends. The
1389 # backend code now only sees strings.
1391 # Revision 1.22  2001/10/09 07:25:59  richard
1392 # Added the Password property type. See "pydoc roundup.password" for
1393 # implementation details. Have updated some of the documentation too.
1395 # Revision 1.21  2001/10/05 02:23:24  richard
1396 #  . roundup-admin create now prompts for property info if none is supplied
1397 #    on the command-line.
1398 #  . hyperdb Class getprops() method may now return only the mutable
1399 #    properties.
1400 #  . Login now uses cookies, which makes it a whole lot more flexible. We can
1401 #    now support anonymous user access (read-only, unless there's an
1402 #    "anonymous" user, in which case write access is permitted). Login
1403 #    handling has been moved into cgi_client.Client.main()
1404 #  . The "extended" schema is now the default in roundup init.
1405 #  . The schemas have had their page headings modified to cope with the new
1406 #    login handling. Existing installations should copy the interfaces.py
1407 #    file from the roundup lib directory to their instance home.
1408 #  . Incorrectly had a Bizar Software copyright on the cgitb.py module from
1409 #    Ping - has been removed.
1410 #  . Fixed a whole bunch of places in the CGI interface where we should have
1411 #    been returning Not Found instead of throwing an exception.
1412 #  . Fixed a deviation from the spec: trying to modify the 'id' property of
1413 #    an item now throws an exception.
1415 # Revision 1.20  2001/10/04 02:12:42  richard
1416 # Added nicer command-line item adding: passing no arguments will enter an
1417 # interactive more which asks for each property in turn. While I was at it, I
1418 # fixed an implementation problem WRT the spec - I wasn't raising a
1419 # ValueError if the key property was missing from a create(). Also added a
1420 # protected=boolean argument to getprops() so we can list only the mutable
1421 # properties (defaults to yes, which lists the immutables).
1423 # Revision 1.19  2001/08/29 04:47:18  richard
1424 # Fixed CGI client change messages so they actually include the properties
1425 # changed (again).
1427 # Revision 1.18  2001/08/16 07:34:59  richard
1428 # better CGI text searching - but hidden filter fields are disappearing...
1430 # Revision 1.17  2001/08/16 06:59:58  richard
1431 # all searches use re now - and they're all case insensitive
1433 # Revision 1.16  2001/08/15 23:43:18  richard
1434 # Fixed some isFooTypes that I missed.
1435 # Refactored some code in the CGI code.
1437 # Revision 1.15  2001/08/12 06:32:36  richard
1438 # using isinstance(blah, Foo) now instead of isFooType
1440 # Revision 1.14  2001/08/07 00:24:42  richard
1441 # stupid typo
1443 # Revision 1.13  2001/08/07 00:15:51  richard
1444 # Added the copyright/license notice to (nearly) all files at request of
1445 # Bizar Software.
1447 # Revision 1.12  2001/08/02 06:38:17  richard
1448 # Roundupdb now appends "mailing list" information to its messages which
1449 # include the e-mail address and web interface address. Templates may
1450 # override this in their db classes to include specific information (support
1451 # instructions, etc).
1453 # Revision 1.11  2001/08/01 04:24:21  richard
1454 # mailgw was assuming certain properties existed on the issues being created.
1456 # Revision 1.10  2001/07/30 02:38:31  richard
1457 # get() now has a default arg - for migration only.
1459 # Revision 1.9  2001/07/29 09:28:23  richard
1460 # Fixed sorting by clicking on column headings.
1462 # Revision 1.8  2001/07/29 08:27:40  richard
1463 # Fixed handling of passed-in values in form elements (ie. during a
1464 # drill-down)
1466 # Revision 1.7  2001/07/29 07:01:39  richard
1467 # Added vim command to all source so that we don't get no steenkin' tabs :)
1469 # Revision 1.6  2001/07/29 05:36:14  richard
1470 # Cleanup of the link label generation.
1472 # Revision 1.5  2001/07/29 04:05:37  richard
1473 # Added the fabricated property "id".
1475 # Revision 1.4  2001/07/27 06:25:35  richard
1476 # Fixed some of the exceptions so they're the right type.
1477 # Removed the str()-ification of node ids so we don't mask oopsy errors any
1478 # more.
1480 # Revision 1.3  2001/07/27 05:17:14  richard
1481 # just some comments
1483 # Revision 1.2  2001/07/22 12:09:32  richard
1484 # Final commit of Grande Splite
1486 # Revision 1.1  2001/07/22 11:58:35  richard
1487 # More Grande Splite
1490 # vim: set filetype=python ts=4 sw=4 et si