Code

. #565979 ] code error in hyperdb.Class.find
[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.67 2002-06-11 05:02:37 richard 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                 prop = self.properties[propname]
802                 property = node[propname]
803                 if isinstance(prop, Link) and nodeid == property:
804                     l.append(id)
805                 elif isinstance(prop, Multilink) and nodeid in property:
806                     l.append(id)
807         return l
809     def stringFind(self, **requirements):
810         """Locate a particular node by matching a set of its String
811         properties in a caseless search.
813         If the property is not a String property, a TypeError is raised.
814         
815         The return is a list of the id of all nodes that match.
816         """
817         for propname in requirements.keys():
818             prop = self.properties[propname]
819             if isinstance(not prop, String):
820                 raise TypeError, "'%s' not a String property"%propname
821             requirements[propname] = requirements[propname].lower()
822         l = []
823         cldb = self.db.getclassdb(self.classname)
824         for nodeid in self.db.getnodeids(self.classname, cldb):
825             node = self.db.getnode(self.classname, nodeid, cldb)
826             if node.has_key(self.db.RETIRED_FLAG):
827                 continue
828             for key, value in requirements.items():
829                 if node[key] and node[key].lower() != value:
830                     break
831             else:
832                 l.append(nodeid)
833         return l
835     def list(self):
836         """Return a list of the ids of the active nodes in this class."""
837         l = []
838         cn = self.classname
839         cldb = self.db.getclassdb(cn)
840         for nodeid in self.db.getnodeids(cn, cldb):
841             node = self.db.getnode(cn, nodeid, cldb)
842             if node.has_key(self.db.RETIRED_FLAG):
843                 continue
844             l.append(nodeid)
845         l.sort()
846         return l
848     # XXX not in spec
849     def filter(self, search_matches, filterspec, sort, group, 
850             num_re = re.compile('^\d+$')):
851         ''' Return a list of the ids of the active nodes in this class that
852             match the 'filter' spec, sorted by the group spec and then the
853             sort spec
854         '''
855         cn = self.classname
857         # optimise filterspec
858         l = []
859         props = self.getprops()
860         for k, v in filterspec.items():
861             propclass = props[k]
862             if isinstance(propclass, Link):
863                 if type(v) is not type([]):
864                     v = [v]
865                 # replace key values with node ids
866                 u = []
867                 link_class =  self.db.classes[propclass.classname]
868                 for entry in v:
869                     if entry == '-1': entry = None
870                     elif not num_re.match(entry):
871                         try:
872                             entry = link_class.lookup(entry)
873                         except (TypeError,KeyError):
874                             raise ValueError, 'property "%s": %s not a %s'%(
875                                 k, entry, self.properties[k].classname)
876                     u.append(entry)
878                 l.append((0, k, u))
879             elif isinstance(propclass, Multilink):
880                 if type(v) is not type([]):
881                     v = [v]
882                 # replace key values with node ids
883                 u = []
884                 link_class =  self.db.classes[propclass.classname]
885                 for entry in v:
886                     if not num_re.match(entry):
887                         try:
888                             entry = link_class.lookup(entry)
889                         except (TypeError,KeyError):
890                             raise ValueError, 'new property "%s": %s not a %s'%(
891                                 k, entry, self.properties[k].classname)
892                     u.append(entry)
893                 l.append((1, k, u))
894             elif isinstance(propclass, String):
895                 # simple glob searching
896                 v = re.sub(r'([\|\{\}\\\.\+\[\]\(\)])', r'\\\1', v)
897                 v = v.replace('?', '.')
898                 v = v.replace('*', '.*?')
899                 l.append((2, k, re.compile(v, re.I)))
900             else:
901                 l.append((6, k, v))
902         filterspec = l
904         # now, find all the nodes that are active and pass filtering
905         l = []
906         cldb = self.db.getclassdb(cn)
907         for nodeid in self.db.getnodeids(cn, cldb):
908             node = self.db.getnode(cn, nodeid, cldb)
909             if node.has_key(self.db.RETIRED_FLAG):
910                 continue
911             # apply filter
912             for t, k, v in filterspec:
913                 # this node doesn't have this property, so reject it
914                 if not node.has_key(k): break
916                 if t == 0 and node[k] not in v:
917                     # link - if this node'd property doesn't appear in the
918                     # filterspec's nodeid list, skip it
919                     break
920                 elif t == 1:
921                     # multilink - if any of the nodeids required by the
922                     # filterspec aren't in this node's property, then skip
923                     # it
924                     for value in v:
925                         if value not in node[k]:
926                             break
927                     else:
928                         continue
929                     break
930                 elif t == 2 and (node[k] is None or not v.search(node[k])):
931                     # RE search
932                     break
933                 elif t == 6 and node[k] != v:
934                     # straight value comparison for the other types
935                     break
936             else:
937                 l.append((nodeid, node))
938         l.sort()
940         # filter based on full text search
941         if search_matches is not None:
942             k = []
943             l_debug = []
944             for v in l:
945                 l_debug.append(v[0])
946                 if search_matches.has_key(v[0]):
947                     k.append(v)
948             l = k
950         # optimise sort
951         m = []
952         for entry in sort:
953             if entry[0] != '-':
954                 m.append(('+', entry))
955             else:
956                 m.append((entry[0], entry[1:]))
957         sort = m
959         # optimise group
960         m = []
961         for entry in group:
962             if entry[0] != '-':
963                 m.append(('+', entry))
964             else:
965                 m.append((entry[0], entry[1:]))
966         group = m
967         # now, sort the result
968         def sortfun(a, b, sort=sort, group=group, properties=self.getprops(),
969                 db = self.db, cl=self):
970             a_id, an = a
971             b_id, bn = b
972             # sort by group and then sort
973             for list in group, sort:
974                 for dir, prop in list:
975                     # sorting is class-specific
976                     propclass = properties[prop]
978                     # handle the properties that might be "faked"
979                     # also, handle possible missing properties
980                     try:
981                         if not an.has_key(prop):
982                             an[prop] = cl.get(a_id, prop)
983                         av = an[prop]
984                     except KeyError:
985                         # the node doesn't have a value for this property
986                         if isinstance(propclass, Multilink): av = []
987                         else: av = ''
988                     try:
989                         if not bn.has_key(prop):
990                             bn[prop] = cl.get(b_id, prop)
991                         bv = bn[prop]
992                     except KeyError:
993                         # the node doesn't have a value for this property
994                         if isinstance(propclass, Multilink): bv = []
995                         else: bv = ''
997                     # String and Date values are sorted in the natural way
998                     if isinstance(propclass, String):
999                         # clean up the strings
1000                         if av and av[0] in string.uppercase:
1001                             av = an[prop] = av.lower()
1002                         if bv and bv[0] in string.uppercase:
1003                             bv = bn[prop] = bv.lower()
1004                     if (isinstance(propclass, String) or
1005                             isinstance(propclass, Date)):
1006                         # it might be a string that's really an integer
1007                         try:
1008                             av = int(av)
1009                             bv = int(bv)
1010                         except:
1011                             pass
1012                         if dir == '+':
1013                             r = cmp(av, bv)
1014                             if r != 0: return r
1015                         elif dir == '-':
1016                             r = cmp(bv, av)
1017                             if r != 0: return r
1019                     # Link properties are sorted according to the value of
1020                     # the "order" property on the linked nodes if it is
1021                     # present; or otherwise on the key string of the linked
1022                     # nodes; or finally on  the node ids.
1023                     elif isinstance(propclass, Link):
1024                         link = db.classes[propclass.classname]
1025                         if av is None and bv is not None: return -1
1026                         if av is not None and bv is None: return 1
1027                         if av is None and bv is None: continue
1028                         if link.getprops().has_key('order'):
1029                             if dir == '+':
1030                                 r = cmp(link.get(av, 'order'),
1031                                     link.get(bv, 'order'))
1032                                 if r != 0: return r
1033                             elif dir == '-':
1034                                 r = cmp(link.get(bv, 'order'),
1035                                     link.get(av, 'order'))
1036                                 if r != 0: return r
1037                         elif link.getkey():
1038                             key = link.getkey()
1039                             if dir == '+':
1040                                 r = cmp(link.get(av, key), link.get(bv, key))
1041                                 if r != 0: return r
1042                             elif dir == '-':
1043                                 r = cmp(link.get(bv, key), link.get(av, key))
1044                                 if r != 0: return r
1045                         else:
1046                             if dir == '+':
1047                                 r = cmp(av, bv)
1048                                 if r != 0: return r
1049                             elif dir == '-':
1050                                 r = cmp(bv, av)
1051                                 if r != 0: return r
1053                     # Multilink properties are sorted according to how many
1054                     # links are present.
1055                     elif isinstance(propclass, Multilink):
1056                         if dir == '+':
1057                             r = cmp(len(av), len(bv))
1058                             if r != 0: return r
1059                         elif dir == '-':
1060                             r = cmp(len(bv), len(av))
1061                             if r != 0: return r
1062                 # end for dir, prop in list:
1063             # end for list in sort, group:
1064             # if all else fails, compare the ids
1065             return cmp(a[0], b[0])
1067         l.sort(sortfun)
1068         return [i[0] for i in l]
1070     def count(self):
1071         """Get the number of nodes in this class.
1073         If the returned integer is 'numnodes', the ids of all the nodes
1074         in this class run from 1 to numnodes, and numnodes+1 will be the
1075         id of the next node to be created in this class.
1076         """
1077         return self.db.countnodes(self.classname)
1079     # Manipulating properties:
1081     def getprops(self, protected=1):
1082         """Return a dictionary mapping property names to property objects.
1083            If the "protected" flag is true, we include protected properties -
1084            those which may not be modified."""
1085         d = self.properties.copy()
1086         if protected:
1087             d['id'] = String()
1088         return d
1090     def addprop(self, **properties):
1091         """Add properties to this class.
1093         The keyword arguments in 'properties' must map names to property
1094         objects, or a TypeError is raised.  None of the keys in 'properties'
1095         may collide with the names of existing properties, or a ValueError
1096         is raised before any properties have been added.
1097         """
1098         for key in properties.keys():
1099             if self.properties.has_key(key):
1100                 raise ValueError, key
1101         self.properties.update(properties)
1103 # XXX not in spec
1104 class Node:
1105     ''' A convenience wrapper for the given node
1106     '''
1107     def __init__(self, cl, nodeid, cache=1):
1108         self.__dict__['cl'] = cl
1109         self.__dict__['nodeid'] = nodeid
1110         self.__dict__['cache'] = cache
1111     def keys(self, protected=1):
1112         return self.cl.getprops(protected=protected).keys()
1113     def values(self, protected=1):
1114         l = []
1115         for name in self.cl.getprops(protected=protected).keys():
1116             l.append(self.cl.get(self.nodeid, name, cache=self.cache))
1117         return l
1118     def items(self, protected=1):
1119         l = []
1120         for name in self.cl.getprops(protected=protected).keys():
1121             l.append((name, self.cl.get(self.nodeid, name, cache=self.cache)))
1122         return l
1123     def has_key(self, name):
1124         return self.cl.getprops().has_key(name)
1125     def __getattr__(self, name):
1126         if self.__dict__.has_key(name):
1127             return self.__dict__[name]
1128         try:
1129             return self.cl.get(self.nodeid, name, cache=self.cache)
1130         except KeyError, value:
1131             # we trap this but re-raise it as AttributeError - all other
1132             # exceptions should pass through untrapped
1133             pass
1134         # nope, no such attribute
1135         raise AttributeError, str(value)
1136     def __getitem__(self, name):
1137         return self.cl.get(self.nodeid, name, cache=self.cache)
1138     def __setattr__(self, name, value):
1139         try:
1140             return self.cl.set(self.nodeid, **{name: value})
1141         except KeyError, value:
1142             raise AttributeError, str(value)
1143     def __setitem__(self, name, value):
1144         self.cl.set(self.nodeid, **{name: value})
1145     def history(self):
1146         return self.cl.history(self.nodeid)
1147     def retire(self):
1148         return self.cl.retire(self.nodeid)
1151 def Choice(name, db, *options):
1152     '''Quick helper to create a simple class with choices
1153     '''
1154     cl = Class(db, name, name=String(), order=String())
1155     for i in range(len(options)):
1156         cl.create(name=options[i], order=i)
1157     return hyperdb.Link(name)
1160 # $Log: not supported by cvs2svn $
1161 # Revision 1.66  2002/05/25 07:16:24  rochecompaan
1162 # Merged search_indexing-branch with HEAD
1164 # Revision 1.65  2002/05/22 04:12:05  richard
1165 #  . applied patch #558876 ] cgi client customization
1166 #    ... with significant additions and modifications ;)
1167 #    - extended handling of ML assignedto to all places it's handled
1168 #    - added more NotFound info
1170 # Revision 1.64  2002/05/15 06:21:21  richard
1171 #  . node caching now works, and gives a small boost in performance
1173 # As a part of this, I cleaned up the DEBUG output and implemented TRACE
1174 # output (HYPERDBTRACE='file to trace to') with checkpoints at the start of
1175 # CGI requests. Run roundup with python -O to skip all the DEBUG/TRACE stuff
1176 # (using if __debug__ which is compiled out with -O)
1178 # Revision 1.63  2002/04/15 23:25:15  richard
1179 # . node ids are now generated from a lockable store - no more race conditions
1181 # We're using the portalocker code by Jonathan Feinberg that was contributed
1182 # to the ASPN Python cookbook. This gives us locking across Unix and Windows.
1184 # Revision 1.62  2002/04/03 07:05:50  richard
1185 # d'oh! killed retirement of nodes :(
1186 # all better now...
1188 # Revision 1.61  2002/04/03 06:11:51  richard
1189 # Fix for old databases that contain properties that don't exist any more.
1191 # Revision 1.60  2002/04/03 05:54:31  richard
1192 # Fixed serialisation problem by moving the serialisation step out of the
1193 # hyperdb.Class (get, set) into the hyperdb.Database.
1195 # Also fixed htmltemplate after the showid changes I made yesterday.
1197 # Unit tests for all of the above written.
1199 # Revision 1.59.2.2  2002/04/20 13:23:33  rochecompaan
1200 # We now have a separate search page for nodes.  Search links for
1201 # different classes can be customized in instance_config similar to
1202 # index links.
1204 # Revision 1.59.2.1  2002/04/19 19:54:42  rochecompaan
1205 # cgi_client.py
1206 #     removed search link for the time being
1207 #     moved rendering of matches to htmltemplate
1208 # hyperdb.py
1209 #     filtering of nodes on full text search incorporated in filter method
1210 # roundupdb.py
1211 #     added paramater to call of filter method
1212 # roundup_indexer.py
1213 #     added search method to RoundupIndexer class
1215 # Revision 1.59  2002/03/12 22:52:26  richard
1216 # more pychecker warnings removed
1218 # Revision 1.58  2002/02/27 03:23:16  richard
1219 # Ran it through pychecker, made fixes
1221 # Revision 1.57  2002/02/20 05:23:24  richard
1222 # Didn't accomodate new values for new properties
1224 # Revision 1.56  2002/02/20 05:05:28  richard
1225 #  . Added simple editing for classes that don't define a templated interface.
1226 #    - access using the admin "class list" interface
1227 #    - limited to admin-only
1228 #    - requires the csv module from object-craft (url given if it's missing)
1230 # Revision 1.55  2002/02/15 07:27:12  richard
1231 # Oops, precedences around the way w0rng.
1233 # Revision 1.54  2002/02/15 07:08:44  richard
1234 #  . Alternate email addresses are now available for users. See the MIGRATION
1235 #    file for info on how to activate the feature.
1237 # Revision 1.53  2002/01/22 07:21:13  richard
1238 # . fixed back_bsddb so it passed the journal tests
1240 # ... it didn't seem happy using the back_anydbm _open method, which is odd.
1241 # Yet another occurrance of whichdb not being able to recognise older bsddb
1242 # databases. Yadda yadda. Made the HYPERDBDEBUG stuff more sane in the
1243 # process.
1245 # Revision 1.52  2002/01/21 16:33:19  rochecompaan
1246 # You can now use the roundup-admin tool to pack the database
1248 # Revision 1.51  2002/01/21 03:01:29  richard
1249 # brief docco on the do_journal argument
1251 # Revision 1.50  2002/01/19 13:16:04  rochecompaan
1252 # Journal entries for link and multilink properties can now be switched on
1253 # or off.
1255 # Revision 1.49  2002/01/16 07:02:57  richard
1256 #  . lots of date/interval related changes:
1257 #    - more relaxed date format for input
1259 # Revision 1.48  2002/01/14 06:32:34  richard
1260 #  . #502951 ] adding new properties to old database
1262 # Revision 1.47  2002/01/14 02:20:15  richard
1263 #  . changed all config accesses so they access either the instance or the
1264 #    config attriubute on the db. This means that all config is obtained from
1265 #    instance_config instead of the mish-mash of classes. This will make
1266 #    switching to a ConfigParser setup easier too, I hope.
1268 # At a minimum, this makes migration a _little_ easier (a lot easier in the
1269 # 0.5.0 switch, I hope!)
1271 # Revision 1.46  2002/01/07 10:42:23  richard
1272 # oops
1274 # Revision 1.45  2002/01/02 04:18:17  richard
1275 # hyperdb docstrings
1277 # Revision 1.44  2002/01/02 02:31:38  richard
1278 # Sorry for the huge checkin message - I was only intending to implement #496356
1279 # but I found a number of places where things had been broken by transactions:
1280 #  . modified ROUNDUPDBSENDMAILDEBUG to be SENDMAILDEBUG and hold a filename
1281 #    for _all_ roundup-generated smtp messages to be sent to.
1282 #  . the transaction cache had broken the roundupdb.Class set() reactors
1283 #  . newly-created author users in the mailgw weren't being committed to the db
1285 # Stuff that made it into CHANGES.txt (ie. the stuff I was actually working
1286 # on when I found that stuff :):
1287 #  . #496356 ] Use threading in messages
1288 #  . detectors were being registered multiple times
1289 #  . added tests for mailgw
1290 #  . much better attaching of erroneous messages in the mail gateway
1292 # Revision 1.43  2001/12/20 06:13:24  rochecompaan
1293 # Bugs fixed:
1294 #   . Exception handling in hyperdb for strings-that-look-like numbers got
1295 #     lost somewhere
1296 #   . Internet Explorer submits full path for filename - we now strip away
1297 #     the path
1298 # Features added:
1299 #   . Link and multilink properties are now displayed sorted in the cgi
1300 #     interface
1302 # Revision 1.42  2001/12/16 10:53:37  richard
1303 # take a copy of the node dict so that the subsequent set
1304 # operation doesn't modify the oldvalues structure
1306 # Revision 1.41  2001/12/15 23:47:47  richard
1307 # Cleaned up some bare except statements
1309 # Revision 1.40  2001/12/14 23:42:57  richard
1310 # yuck, a gdbm instance tests false :(
1311 # I've left the debugging code in - it should be removed one day if we're ever
1312 # _really_ anal about performace :)
1314 # Revision 1.39  2001/12/02 05:06:16  richard
1315 # . We now use weakrefs in the Classes to keep the database reference, so
1316 #   the close() method on the database is no longer needed.
1317 #   I bumped the minimum python requirement up to 2.1 accordingly.
1318 # . #487480 ] roundup-server
1319 # . #487476 ] INSTALL.txt
1321 # I also cleaned up the change message / post-edit stuff in the cgi client.
1322 # There's now a clearly marked "TODO: append the change note" where I believe
1323 # the change note should be added there. The "changes" list will obviously
1324 # have to be modified to be a dict of the changes, or somesuch.
1326 # More testing needed.
1328 # Revision 1.38  2001/12/01 07:17:50  richard
1329 # . We now have basic transaction support! Information is only written to
1330 #   the database when the commit() method is called. Only the anydbm
1331 #   backend is modified in this way - neither of the bsddb backends have been.
1332 #   The mail, admin and cgi interfaces all use commit (except the admin tool
1333 #   doesn't have a commit command, so interactive users can't commit...)
1334 # . Fixed login/registration forwarding the user to the right page (or not,
1335 #   on a failure)
1337 # Revision 1.37  2001/11/28 21:55:35  richard
1338 #  . login_action and newuser_action return values were being ignored
1339 #  . Woohoo! Found that bloody re-login bug that was killing the mail
1340 #    gateway.
1341 #  (also a minor cleanup in hyperdb)
1343 # Revision 1.36  2001/11/27 03:16:09  richard
1344 # Another place that wasn't handling missing properties.
1346 # Revision 1.35  2001/11/22 15:46:42  jhermann
1347 # Added module docstrings to all modules.
1349 # Revision 1.34  2001/11/21 04:04:43  richard
1350 # *sigh* more missing value handling
1352 # Revision 1.33  2001/11/21 03:40:54  richard
1353 # more new property handling
1355 # Revision 1.32  2001/11/21 03:11:28  richard
1356 # Better handling of new properties.
1358 # Revision 1.31  2001/11/12 22:01:06  richard
1359 # Fixed issues with nosy reaction and author copies.
1361 # Revision 1.30  2001/11/09 10:11:08  richard
1362 #  . roundup-admin now handles all hyperdb exceptions
1364 # Revision 1.29  2001/10/27 00:17:41  richard
1365 # Made Class.stringFind() do caseless matching.
1367 # Revision 1.28  2001/10/21 04:44:50  richard
1368 # bug #473124: UI inconsistency with Link fields.
1369 #    This also prompted me to fix a fairly long-standing usability issue -
1370 #    that of being able to turn off certain filters.
1372 # Revision 1.27  2001/10/20 23:44:27  richard
1373 # Hyperdatabase sorts strings-that-look-like-numbers as numbers now.
1375 # Revision 1.26  2001/10/16 03:48:01  richard
1376 # admin tool now complains if a "find" is attempted with a non-link property.
1378 # Revision 1.25  2001/10/11 00:17:51  richard
1379 # Reverted a change in hyperdb so the default value for missing property
1380 # values in a create() is None and not '' (the empty string.) This obviously
1381 # breaks CSV import/export - the string 'None' will be created in an
1382 # export/import operation.
1384 # Revision 1.24  2001/10/10 03:54:57  richard
1385 # Added database importing and exporting through CSV files.
1386 # Uses the csv module from object-craft for exporting if it's available.
1387 # Requires the csv module for importing.
1389 # Revision 1.23  2001/10/09 23:58:10  richard
1390 # Moved the data stringification up into the hyperdb.Class class' get, set
1391 # and create methods. This means that the data is also stringified for the
1392 # journal call, and removes duplication of code from the backends. The
1393 # backend code now only sees strings.
1395 # Revision 1.22  2001/10/09 07:25:59  richard
1396 # Added the Password property type. See "pydoc roundup.password" for
1397 # implementation details. Have updated some of the documentation too.
1399 # Revision 1.21  2001/10/05 02:23:24  richard
1400 #  . roundup-admin create now prompts for property info if none is supplied
1401 #    on the command-line.
1402 #  . hyperdb Class getprops() method may now return only the mutable
1403 #    properties.
1404 #  . Login now uses cookies, which makes it a whole lot more flexible. We can
1405 #    now support anonymous user access (read-only, unless there's an
1406 #    "anonymous" user, in which case write access is permitted). Login
1407 #    handling has been moved into cgi_client.Client.main()
1408 #  . The "extended" schema is now the default in roundup init.
1409 #  . The schemas have had their page headings modified to cope with the new
1410 #    login handling. Existing installations should copy the interfaces.py
1411 #    file from the roundup lib directory to their instance home.
1412 #  . Incorrectly had a Bizar Software copyright on the cgitb.py module from
1413 #    Ping - has been removed.
1414 #  . Fixed a whole bunch of places in the CGI interface where we should have
1415 #    been returning Not Found instead of throwing an exception.
1416 #  . Fixed a deviation from the spec: trying to modify the 'id' property of
1417 #    an item now throws an exception.
1419 # Revision 1.20  2001/10/04 02:12:42  richard
1420 # Added nicer command-line item adding: passing no arguments will enter an
1421 # interactive more which asks for each property in turn. While I was at it, I
1422 # fixed an implementation problem WRT the spec - I wasn't raising a
1423 # ValueError if the key property was missing from a create(). Also added a
1424 # protected=boolean argument to getprops() so we can list only the mutable
1425 # properties (defaults to yes, which lists the immutables).
1427 # Revision 1.19  2001/08/29 04:47:18  richard
1428 # Fixed CGI client change messages so they actually include the properties
1429 # changed (again).
1431 # Revision 1.18  2001/08/16 07:34:59  richard
1432 # better CGI text searching - but hidden filter fields are disappearing...
1434 # Revision 1.17  2001/08/16 06:59:58  richard
1435 # all searches use re now - and they're all case insensitive
1437 # Revision 1.16  2001/08/15 23:43:18  richard
1438 # Fixed some isFooTypes that I missed.
1439 # Refactored some code in the CGI code.
1441 # Revision 1.15  2001/08/12 06:32:36  richard
1442 # using isinstance(blah, Foo) now instead of isFooType
1444 # Revision 1.14  2001/08/07 00:24:42  richard
1445 # stupid typo
1447 # Revision 1.13  2001/08/07 00:15:51  richard
1448 # Added the copyright/license notice to (nearly) all files at request of
1449 # Bizar Software.
1451 # Revision 1.12  2001/08/02 06:38:17  richard
1452 # Roundupdb now appends "mailing list" information to its messages which
1453 # include the e-mail address and web interface address. Templates may
1454 # override this in their db classes to include specific information (support
1455 # instructions, etc).
1457 # Revision 1.11  2001/08/01 04:24:21  richard
1458 # mailgw was assuming certain properties existed on the issues being created.
1460 # Revision 1.10  2001/07/30 02:38:31  richard
1461 # get() now has a default arg - for migration only.
1463 # Revision 1.9  2001/07/29 09:28:23  richard
1464 # Fixed sorting by clicking on column headings.
1466 # Revision 1.8  2001/07/29 08:27:40  richard
1467 # Fixed handling of passed-in values in form elements (ie. during a
1468 # drill-down)
1470 # Revision 1.7  2001/07/29 07:01:39  richard
1471 # Added vim command to all source so that we don't get no steenkin' tabs :)
1473 # Revision 1.6  2001/07/29 05:36:14  richard
1474 # Cleanup of the link label generation.
1476 # Revision 1.5  2001/07/29 04:05:37  richard
1477 # Added the fabricated property "id".
1479 # Revision 1.4  2001/07/27 06:25:35  richard
1480 # Fixed some of the exceptions so they're the right type.
1481 # Removed the str()-ification of node ids so we don't mask oopsy errors any
1482 # more.
1484 # Revision 1.3  2001/07/27 05:17:14  richard
1485 # just some comments
1487 # Revision 1.2  2001/07/22 12:09:32  richard
1488 # Final commit of Grande Splite
1490 # Revision 1.1  2001/07/22 11:58:35  richard
1491 # More Grande Splite
1494 # vim: set filetype=python ts=4 sw=4 et si