Code

Removed the confusing, ugly two-column sorting stuff. Column heading clicks
[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.79 2002-07-29 23:30:14 richard Exp $
20 __doc__ = """
21 Hyperdatabase implementation, especially field types.
22 """
24 # standard python modules
25 import sys, os, time, re
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     if DEBUG == 'stdout':
37         DEBUG = sys.stdout
38     else:
39         DEBUG = open(DEBUG, 'a')
40 else:
41     DEBUG = Sink()
42 TRACE = os.environ.get('HYPERDBTRACE', '')
43 if TRACE and __debug__:
44     if TRACE == 'stdout':
45         TRACE = sys.stdout
46     else:
47         TRACE = open(TRACE, 'w')
48 else:
49     TRACE = Sink()
50 def traceMark():
51     print >>TRACE, '**MARK', time.ctime()
52 del Sink
54 #
55 # Types
56 #
57 class String:
58     """An object designating a String property."""
59     def __init__(self, indexme='no'):
60         self.indexme = indexme == 'yes'
61     def __repr__(self):
62         ' more useful for dumps '
63         return '<%s>'%self.__class__
65 class Password:
66     """An object designating a Password property."""
67     def __repr__(self):
68         ' more useful for dumps '
69         return '<%s>'%self.__class__
71 class Date:
72     """An object designating a Date property."""
73     def __repr__(self):
74         ' more useful for dumps '
75         return '<%s>'%self.__class__
77 class Interval:
78     """An object designating an Interval property."""
79     def __repr__(self):
80         ' more useful for dumps '
81         return '<%s>'%self.__class__
83 class Link:
84     """An object designating a Link property that links to a
85        node in a specified class."""
86     def __init__(self, classname, do_journal='no'):
87         ''' Default is to not journal link and unlink events
88         '''
89         self.classname = classname
90         self.do_journal = do_journal == 'yes'
91     def __repr__(self):
92         ' more useful for dumps '
93         return '<%s to "%s">'%(self.__class__, self.classname)
95 class Multilink:
96     """An object designating a Multilink property that links
97        to nodes in a specified class.
99        "classname" indicates the class to link to
101        "do_journal" indicates whether the linked-to nodes should have
102                     'link' and 'unlink' events placed in their journal
103     """
104     def __init__(self, classname, do_journal='no'):
105         ''' Default is to not journal link and unlink events
106         '''
107         self.classname = classname
108         self.do_journal = do_journal == 'yes'
109     def __repr__(self):
110         ' more useful for dumps '
111         return '<%s to "%s">'%(self.__class__, self.classname)
113 class Boolean:
114     """An object designating a boolean property"""
115     def __repr__(self):
116         'more useful for dumps'
117         return '<%s>' % self.__class__
118     
119 class Number:
120     """An object designating a numeric property"""
121     def __repr__(self):
122         'more useful for dumps'
123         return '<%s>' % self.__class__
125 # Support for splitting designators
127 class DesignatorError(ValueError):
128     pass
129 def splitDesignator(designator, dre=re.compile(r'([^\d]+)(\d+)')):
130     ''' Take a foo123 and return ('foo', 123)
131     '''
132     m = dre.match(designator)
133     if m is None:
134         raise DesignatorError, '"%s" not a node designator'%designator
135     return m.group(1), m.group(2)
138 # the base Database class
140 class DatabaseError(ValueError):
141     '''Error to be raised when there is some problem in the database code
142     '''
143     pass
144 class Database:
145     '''A database for storing records containing flexible data types.
147 This class defines a hyperdatabase storage layer, which the Classes use to
148 store their data.
151 Transactions
152 ------------
153 The Database should support transactions through the commit() and
154 rollback() methods. All other Database methods should be transaction-aware,
155 using data from the current transaction before looking up the database.
157 An implementation must provide an override for the get() method so that the
158 in-database value is returned in preference to the in-transaction value.
159 This is necessary to determine if any values have changed during a
160 transaction.
163 Implementation
164 --------------
166 All methods except __repr__ and getnode must be implemented by a
167 concrete backend Class.
169 '''
171     # flag to set on retired entries
172     RETIRED_FLAG = '__hyperdb_retired'
174     def __init__(self, config, journaltag=None):
175         """Open a hyperdatabase given a specifier to some storage.
177         The 'storagelocator' is obtained from config.DATABASE.
178         The meaning of 'storagelocator' depends on the particular
179         implementation of the hyperdatabase.  It could be a file name,
180         a directory path, a socket descriptor for a connection to a
181         database over the network, etc.
183         The 'journaltag' is a token that will be attached to the journal
184         entries for any edits done on the database.  If 'journaltag' is
185         None, the database is opened in read-only mode: the Class.create(),
186         Class.set(), and Class.retire() methods are disabled.
187         """
188         raise NotImplementedError
190     def post_init(self):
191         """Called once the schema initialisation has finished."""
192         raise NotImplementedError
194     def __getattr__(self, classname):
195         """A convenient way of calling self.getclass(classname)."""
196         raise NotImplementedError
198     def addclass(self, cl):
199         '''Add a Class to the hyperdatabase.
200         '''
201         raise NotImplementedError
203     def getclasses(self):
204         """Return a list of the names of all existing classes."""
205         raise NotImplementedError
207     def getclass(self, classname):
208         """Get the Class object representing a particular class.
210         If 'classname' is not a valid class name, a KeyError is raised.
211         """
212         raise NotImplementedError
214     def clear(self):
215         '''Delete all database contents.
216         '''
217         raise NotImplementedError
219     def getclassdb(self, classname, mode='r'):
220         '''Obtain a connection to the class db that will be used for
221            multiple actions.
222         '''
223         raise NotImplementedError
225     def addnode(self, classname, nodeid, node):
226         '''Add the specified node to its class's db.
227         '''
228         raise NotImplementedError
230     def serialise(self, classname, node):
231         '''Copy the node contents, converting non-marshallable data into
232            marshallable data.
233         '''
234         return node
236     def setnode(self, classname, nodeid, node):
237         '''Change the specified node.
238         '''
239         raise NotImplementedError
241     def unserialise(self, classname, node):
242         '''Decode the marshalled node data
243         '''
244         return node
246     def getnode(self, classname, nodeid, db=None, cache=1):
247         '''Get a node from the database.
248         '''
249         raise NotImplementedError
251     def hasnode(self, classname, nodeid, db=None):
252         '''Determine if the database has a given node.
253         '''
254         raise NotImplementedError
256     def countnodes(self, classname, db=None):
257         '''Count the number of nodes that exist for a particular Class.
258         '''
259         raise NotImplementedError
261     def getnodeids(self, classname, db=None):
262         '''Retrieve all the ids of the nodes for a particular Class.
263         '''
264         raise NotImplementedError
266     def storefile(self, classname, nodeid, property, content):
267         '''Store the content of the file in the database.
268         
269            The property may be None, in which case the filename does not
270            indicate which property is being saved.
271         '''
272         raise NotImplementedError
274     def getfile(self, classname, nodeid, property):
275         '''Store the content of the file in the database.
276         '''
277         raise NotImplementedError
279     def addjournal(self, classname, nodeid, action, params):
280         ''' Journal the Action
281         'action' may be:
283             'create' or 'set' -- 'params' is a dictionary of property values
284             'link' or 'unlink' -- 'params' is (classname, nodeid, propname)
285             'retire' -- 'params' is None
286         '''
287         raise NotImplementedError
289     def getjournal(self, classname, nodeid):
290         ''' get the journal for id
291         '''
292         raise NotImplementedError
294     def pack(self, pack_before):
295         ''' pack the database
296         '''
297         raise NotImplementedError
299     def commit(self):
300         ''' Commit the current transactions.
302         Save all data changed since the database was opened or since the
303         last commit() or rollback().
304         '''
305         raise NotImplementedError
307     def rollback(self):
308         ''' Reverse all actions from the current transaction.
310         Undo all the changes made since the database was opened or the last
311         commit() or rollback() was performed.
312         '''
313         raise NotImplementedError
316 # The base Class class
318 class Class:
319     """ The handle to a particular class of nodes in a hyperdatabase.
320         
321         All methods except __repr__ and getnode must be implemented by a
322         concrete backend Class.
323     """
325     def __init__(self, db, classname, **properties):
326         """Create a new class with a given name and property specification.
328         'classname' must not collide with the name of an existing class,
329         or a ValueError is raised.  The keyword arguments in 'properties'
330         must map names to property objects, or a TypeError is raised.
331         """
332         raise NotImplementedError
334     def __repr__(self):
335         '''Slightly more useful representation
336         '''
337         return '<hypderdb.Class "%s">'%self.classname
339     # Editing nodes:
341     def create(self, **propvalues):
342         """Create a new node of this class and return its id.
344         The keyword arguments in 'propvalues' map property names to values.
346         The values of arguments must be acceptable for the types of their
347         corresponding properties or a TypeError is raised.
348         
349         If this class has a key property, it must be present and its value
350         must not collide with other key strings or a ValueError is raised.
351         
352         Any other properties on this class that are missing from the
353         'propvalues' dictionary are set to None.
354         
355         If an id in a link or multilink property does not refer to a valid
356         node, an IndexError is raised.
357         """
358         raise NotImplementedError
360     _marker = []
361     def get(self, nodeid, propname, default=_marker, cache=1):
362         """Get the value of a property on an existing node of this class.
364         'nodeid' must be the id of an existing node of this class or an
365         IndexError is raised.  'propname' must be the name of a property
366         of this class or a KeyError is raised.
368         'cache' indicates whether the transaction cache should be queried
369         for the node. If the node has been modified and you need to
370         determine what its values prior to modification are, you need to
371         set cache=0.
372         """
373         raise NotImplementedError
375     def getnode(self, nodeid, cache=1):
376         ''' Return a convenience wrapper for the node.
378         'nodeid' must be the id of an existing node of this class or an
379         IndexError is raised.
381         'cache' indicates whether the transaction cache should be queried
382         for the node. If the node has been modified and you need to
383         determine what its values prior to modification are, you need to
384         set cache=0.
385         '''
386         return Node(self, nodeid, cache=cache)
388     def set(self, nodeid, **propvalues):
389         """Modify a property on an existing node of this class.
390         
391         'nodeid' must be the id of an existing node of this class or an
392         IndexError is raised.
394         Each key in 'propvalues' must be the name of a property of this
395         class or a KeyError is raised.
397         All values in 'propvalues' must be acceptable types for their
398         corresponding properties or a TypeError is raised.
400         If the value of the key property is set, it must not collide with
401         other key strings or a ValueError is raised.
403         If the value of a Link or Multilink property contains an invalid
404         node id, a ValueError is raised.
405         """
406         raise NotImplementedError
408     def retire(self, nodeid):
409         """Retire a node.
410         
411         The properties on the node remain available from the get() method,
412         and the node's id is never reused.
413         
414         Retired nodes are not returned by the find(), list(), or lookup()
415         methods, and other nodes may reuse the values of their key properties.
416         """
417         raise NotImplementedError
419     def destroy(self, nodeid):
420         """Destroy a node.
421         
422         WARNING: this method should never be used except in extremely rare
423                  situations where there could never be links to the node being
424                  deleted
425         WARNING: use retire() instead
426         WARNING: the properties of this node will not be available ever again
427         WARNING: really, use retire() instead
429         Well, I think that's enough warnings. This method exists mostly to
430         support the session storage of the cgi interface.
432         The node is completely removed from the hyperdb, including all journal
433         entries. It will no longer be available, and will generally break code
434         if there are any references to the node.
435         """
437     def history(self, nodeid):
438         """Retrieve the journal of edits on a particular node.
440         'nodeid' must be the id of an existing node of this class or an
441         IndexError is raised.
443         The returned list contains tuples of the form
445             (date, tag, action, params)
447         'date' is a Timestamp object specifying the time of the change and
448         'tag' is the journaltag specified when the database was opened.
449         """
450         raise NotImplementedError
452     # Locating nodes:
453     def hasnode(self, nodeid):
454         '''Determine if the given nodeid actually exists
455         '''
456         raise NotImplementedError
458     def setkey(self, propname):
459         """Select a String property of this class to be the key property.
461         'propname' must be the name of a String property of this class or
462         None, or a TypeError is raised.  The values of the key property on
463         all existing nodes must be unique or a ValueError is raised.
464         """
465         raise NotImplementedError
467     def getkey(self):
468         """Return the name of the key property for this class or None."""
469         raise NotImplementedError
471     def labelprop(self, default_to_id=0):
472         ''' Return the property name for a label for the given node.
474         This method attempts to generate a consistent label for the node.
475         It tries the following in order:
476             1. key property
477             2. "name" property
478             3. "title" property
479             4. first property from the sorted property name list
480         '''
481         raise NotImplementedError
483     def lookup(self, keyvalue):
484         """Locate a particular node by its key property and return its id.
486         If this class has no key property, a TypeError is raised.  If the
487         'keyvalue' matches one of the values for the key property among
488         the nodes in this class, the matching node's id is returned;
489         otherwise a KeyError is raised.
490         """
491         raise NotImplementedError
493     def find(self, **propspec):
494         """Get the ids of nodes in this class which link to the given nodes.
496         'propspec' consists of keyword args propname={nodeid:1,}   
497         'propname' must be the name of a property in this class, or a
498         KeyError is raised.  That property must be a Link or Multilink
499         property, or a TypeError is raised.
501         Any node in this class whose 'propname' property links to any of the
502         nodeids will be returned. Used by the full text indexing, which knows
503         that "foo" occurs in msg1, msg3 and file7, so we have hits on these
504         issues:
506             db.issue.find(messages={'1':1,'3':1}, files={'7':1})
507         """
508         raise NotImplementedError
510     def filter(self, search_matches, filterspec, sort, group, 
511             num_re = re.compile('^\d+$')):
512         ''' Return a list of the ids of the active nodes in this class that
513             match the 'filter' spec, sorted by the group spec and then the
514             sort spec
515         '''
516         raise NotImplementedError
518     def count(self):
519         """Get the number of nodes in this class.
521         If the returned integer is 'numnodes', the ids of all the nodes
522         in this class run from 1 to numnodes, and numnodes+1 will be the
523         id of the next node to be created in this class.
524         """
525         raise NotImplementedError
527     # Manipulating properties:
528     def getprops(self, protected=1):
529         """Return a dictionary mapping property names to property objects.
530            If the "protected" flag is true, we include protected properties -
531            those which may not be modified.
532         """
533         raise NotImplementedError
535     def addprop(self, **properties):
536         """Add properties to this class.
538         The keyword arguments in 'properties' must map names to property
539         objects, or a TypeError is raised.  None of the keys in 'properties'
540         may collide with the names of existing properties, or a ValueError
541         is raised before any properties have been added.
542         """
543         raise NotImplementedError
545     def index(self, nodeid):
546         '''Add (or refresh) the node to search indexes
547         '''
548         raise NotImplementedError
550 class Node:
551     ''' A convenience wrapper for the given node
552     '''
553     def __init__(self, cl, nodeid, cache=1):
554         self.__dict__['cl'] = cl
555         self.__dict__['nodeid'] = nodeid
556         self.__dict__['cache'] = cache
557     def keys(self, protected=1):
558         return self.cl.getprops(protected=protected).keys()
559     def values(self, protected=1):
560         l = []
561         for name in self.cl.getprops(protected=protected).keys():
562             l.append(self.cl.get(self.nodeid, name, cache=self.cache))
563         return l
564     def items(self, protected=1):
565         l = []
566         for name in self.cl.getprops(protected=protected).keys():
567             l.append((name, self.cl.get(self.nodeid, name, cache=self.cache)))
568         return l
569     def has_key(self, name):
570         return self.cl.getprops().has_key(name)
571     def __getattr__(self, name):
572         if self.__dict__.has_key(name):
573             return self.__dict__[name]
574         try:
575             return self.cl.get(self.nodeid, name, cache=self.cache)
576         except KeyError, value:
577             # we trap this but re-raise it as AttributeError - all other
578             # exceptions should pass through untrapped
579             pass
580         # nope, no such attribute
581         raise AttributeError, str(value)
582     def __getitem__(self, name):
583         return self.cl.get(self.nodeid, name, cache=self.cache)
584     def __setattr__(self, name, value):
585         try:
586             return self.cl.set(self.nodeid, **{name: value})
587         except KeyError, value:
588             raise AttributeError, str(value)
589     def __setitem__(self, name, value):
590         self.cl.set(self.nodeid, **{name: value})
591     def history(self):
592         return self.cl.history(self.nodeid)
593     def retire(self):
594         return self.cl.retire(self.nodeid)
597 def Choice(name, db, *options):
598     '''Quick helper to create a simple class with choices
599     '''
600     cl = Class(db, name, name=String(), order=String())
601     for i in range(len(options)):
602         cl.create(name=options[i], order=i)
603     return hyperdb.Link(name)
606 # $Log: not supported by cvs2svn $
607 # Revision 1.78  2002/07/21 03:26:37  richard
608 # Gordon, does this help?
610 # Revision 1.77  2002/07/18 11:27:47  richard
611 # ws
613 # Revision 1.76  2002/07/18 11:17:30  gmcm
614 # Add Number and Boolean types to hyperdb.
615 # Add conversion cases to web, mail & admin interfaces.
616 # Add storage/serialization cases to back_anydbm & back_metakit.
618 # Revision 1.75  2002/07/14 02:05:53  richard
619 # . all storage-specific code (ie. backend) is now implemented by the backends
621 # Revision 1.74  2002/07/10 00:24:10  richard
622 # braino
624 # Revision 1.73  2002/07/10 00:19:48  richard
625 # Added explicit closing of backend database handles.
627 # Revision 1.72  2002/07/09 21:53:38  gmcm
628 # Optimize Class.find so that the propspec can contain a set of ids to match.
629 # This is used by indexer.search so it can do just one find for all the index matches.
630 # This was already confusing code, but for common terms (lots of index matches),
631 # it is enormously faster.
633 # Revision 1.71  2002/07/09 03:02:52  richard
634 # More indexer work:
635 # - all String properties may now be indexed too. Currently there's a bit of
636 #   "issue" specific code in the actual searching which needs to be
637 #   addressed. In a nutshell:
638 #   + pass 'indexme="yes"' as a String() property initialisation arg, eg:
639 #         file = FileClass(db, "file", name=String(), type=String(),
640 #             comment=String(indexme="yes"))
641 #   + the comment will then be indexed and be searchable, with the results
642 #     related back to the issue that the file is linked to
643 # - as a result of this work, the FileClass has a default MIME type that may
644 #   be overridden in a subclass, or by the use of a "type" property as is
645 #   done in the default templates.
646 # - the regeneration of the indexes (if necessary) is done once the schema is
647 #   set up in the dbinit.
649 # Revision 1.70  2002/06/27 12:06:20  gmcm
650 # Improve an error message.
652 # Revision 1.69  2002/06/17 23:15:29  richard
653 # Can debug to stdout now
655 # Revision 1.68  2002/06/11 06:52:03  richard
656 #  . #564271 ] find() and new properties
658 # Revision 1.67  2002/06/11 05:02:37  richard
659 #  . #565979 ] code error in hyperdb.Class.find
661 # Revision 1.66  2002/05/25 07:16:24  rochecompaan
662 # Merged search_indexing-branch with HEAD
664 # Revision 1.65  2002/05/22 04:12:05  richard
665 #  . applied patch #558876 ] cgi client customization
666 #    ... with significant additions and modifications ;)
667 #    - extended handling of ML assignedto to all places it's handled
668 #    - added more NotFound info
670 # Revision 1.64  2002/05/15 06:21:21  richard
671 #  . node caching now works, and gives a small boost in performance
673 # As a part of this, I cleaned up the DEBUG output and implemented TRACE
674 # output (HYPERDBTRACE='file to trace to') with checkpoints at the start of
675 # CGI requests. Run roundup with python -O to skip all the DEBUG/TRACE stuff
676 # (using if __debug__ which is compiled out with -O)
678 # Revision 1.63  2002/04/15 23:25:15  richard
679 # . node ids are now generated from a lockable store - no more race conditions
681 # We're using the portalocker code by Jonathan Feinberg that was contributed
682 # to the ASPN Python cookbook. This gives us locking across Unix and Windows.
684 # Revision 1.62  2002/04/03 07:05:50  richard
685 # d'oh! killed retirement of nodes :(
686 # all better now...
688 # Revision 1.61  2002/04/03 06:11:51  richard
689 # Fix for old databases that contain properties that don't exist any more.
691 # Revision 1.60  2002/04/03 05:54:31  richard
692 # Fixed serialisation problem by moving the serialisation step out of the
693 # hyperdb.Class (get, set) into the hyperdb.Database.
695 # Also fixed htmltemplate after the showid changes I made yesterday.
697 # Unit tests for all of the above written.
699 # Revision 1.59.2.2  2002/04/20 13:23:33  rochecompaan
700 # We now have a separate search page for nodes.  Search links for
701 # different classes can be customized in instance_config similar to
702 # index links.
704 # Revision 1.59.2.1  2002/04/19 19:54:42  rochecompaan
705 # cgi_client.py
706 #     removed search link for the time being
707 #     moved rendering of matches to htmltemplate
708 # hyperdb.py
709 #     filtering of nodes on full text search incorporated in filter method
710 # roundupdb.py
711 #     added paramater to call of filter method
712 # roundup_indexer.py
713 #     added search method to RoundupIndexer class
715 # Revision 1.59  2002/03/12 22:52:26  richard
716 # more pychecker warnings removed
718 # Revision 1.58  2002/02/27 03:23:16  richard
719 # Ran it through pychecker, made fixes
721 # Revision 1.57  2002/02/20 05:23:24  richard
722 # Didn't accomodate new values for new properties
724 # Revision 1.56  2002/02/20 05:05:28  richard
725 #  . Added simple editing for classes that don't define a templated interface.
726 #    - access using the admin "class list" interface
727 #    - limited to admin-only
728 #    - requires the csv module from object-craft (url given if it's missing)
730 # Revision 1.55  2002/02/15 07:27:12  richard
731 # Oops, precedences around the way w0rng.
733 # Revision 1.54  2002/02/15 07:08:44  richard
734 #  . Alternate email addresses are now available for users. See the MIGRATION
735 #    file for info on how to activate the feature.
737 # Revision 1.53  2002/01/22 07:21:13  richard
738 # . fixed back_bsddb so it passed the journal tests
740 # ... it didn't seem happy using the back_anydbm _open method, which is odd.
741 # Yet another occurrance of whichdb not being able to recognise older bsddb
742 # databases. Yadda yadda. Made the HYPERDBDEBUG stuff more sane in the
743 # process.
745 # Revision 1.52  2002/01/21 16:33:19  rochecompaan
746 # You can now use the roundup-admin tool to pack the database
748 # Revision 1.51  2002/01/21 03:01:29  richard
749 # brief docco on the do_journal argument
751 # Revision 1.50  2002/01/19 13:16:04  rochecompaan
752 # Journal entries for link and multilink properties can now be switched on
753 # or off.
755 # Revision 1.49  2002/01/16 07:02:57  richard
756 #  . lots of date/interval related changes:
757 #    - more relaxed date format for input
759 # Revision 1.48  2002/01/14 06:32:34  richard
760 #  . #502951 ] adding new properties to old database
762 # Revision 1.47  2002/01/14 02:20:15  richard
763 #  . changed all config accesses so they access either the instance or the
764 #    config attriubute on the db. This means that all config is obtained from
765 #    instance_config instead of the mish-mash of classes. This will make
766 #    switching to a ConfigParser setup easier too, I hope.
768 # At a minimum, this makes migration a _little_ easier (a lot easier in the
769 # 0.5.0 switch, I hope!)
771 # Revision 1.46  2002/01/07 10:42:23  richard
772 # oops
774 # Revision 1.45  2002/01/02 04:18:17  richard
775 # hyperdb docstrings
777 # Revision 1.44  2002/01/02 02:31:38  richard
778 # Sorry for the huge checkin message - I was only intending to implement #496356
779 # but I found a number of places where things had been broken by transactions:
780 #  . modified ROUNDUPDBSENDMAILDEBUG to be SENDMAILDEBUG and hold a filename
781 #    for _all_ roundup-generated smtp messages to be sent to.
782 #  . the transaction cache had broken the roundupdb.Class set() reactors
783 #  . newly-created author users in the mailgw weren't being committed to the db
785 # Stuff that made it into CHANGES.txt (ie. the stuff I was actually working
786 # on when I found that stuff :):
787 #  . #496356 ] Use threading in messages
788 #  . detectors were being registered multiple times
789 #  . added tests for mailgw
790 #  . much better attaching of erroneous messages in the mail gateway
792 # Revision 1.43  2001/12/20 06:13:24  rochecompaan
793 # Bugs fixed:
794 #   . Exception handling in hyperdb for strings-that-look-like numbers got
795 #     lost somewhere
796 #   . Internet Explorer submits full path for filename - we now strip away
797 #     the path
798 # Features added:
799 #   . Link and multilink properties are now displayed sorted in the cgi
800 #     interface
802 # Revision 1.42  2001/12/16 10:53:37  richard
803 # take a copy of the node dict so that the subsequent set
804 # operation doesn't modify the oldvalues structure
806 # Revision 1.41  2001/12/15 23:47:47  richard
807 # Cleaned up some bare except statements
809 # Revision 1.40  2001/12/14 23:42:57  richard
810 # yuck, a gdbm instance tests false :(
811 # I've left the debugging code in - it should be removed one day if we're ever
812 # _really_ anal about performace :)
814 # Revision 1.39  2001/12/02 05:06:16  richard
815 # . We now use weakrefs in the Classes to keep the database reference, so
816 #   the close() method on the database is no longer needed.
817 #   I bumped the minimum python requirement up to 2.1 accordingly.
818 # . #487480 ] roundup-server
819 # . #487476 ] INSTALL.txt
821 # I also cleaned up the change message / post-edit stuff in the cgi client.
822 # There's now a clearly marked "TODO: append the change note" where I believe
823 # the change note should be added there. The "changes" list will obviously
824 # have to be modified to be a dict of the changes, or somesuch.
826 # More testing needed.
828 # Revision 1.38  2001/12/01 07:17:50  richard
829 # . We now have basic transaction support! Information is only written to
830 #   the database when the commit() method is called. Only the anydbm
831 #   backend is modified in this way - neither of the bsddb backends have been.
832 #   The mail, admin and cgi interfaces all use commit (except the admin tool
833 #   doesn't have a commit command, so interactive users can't commit...)
834 # . Fixed login/registration forwarding the user to the right page (or not,
835 #   on a failure)
837 # Revision 1.37  2001/11/28 21:55:35  richard
838 #  . login_action and newuser_action return values were being ignored
839 #  . Woohoo! Found that bloody re-login bug that was killing the mail
840 #    gateway.
841 #  (also a minor cleanup in hyperdb)
843 # Revision 1.36  2001/11/27 03:16:09  richard
844 # Another place that wasn't handling missing properties.
846 # Revision 1.35  2001/11/22 15:46:42  jhermann
847 # Added module docstrings to all modules.
849 # Revision 1.34  2001/11/21 04:04:43  richard
850 # *sigh* more missing value handling
852 # Revision 1.33  2001/11/21 03:40:54  richard
853 # more new property handling
855 # Revision 1.32  2001/11/21 03:11:28  richard
856 # Better handling of new properties.
858 # Revision 1.31  2001/11/12 22:01:06  richard
859 # Fixed issues with nosy reaction and author copies.
861 # Revision 1.30  2001/11/09 10:11:08  richard
862 #  . roundup-admin now handles all hyperdb exceptions
864 # Revision 1.29  2001/10/27 00:17:41  richard
865 # Made Class.stringFind() do caseless matching.
867 # Revision 1.28  2001/10/21 04:44:50  richard
868 # bug #473124: UI inconsistency with Link fields.
869 #    This also prompted me to fix a fairly long-standing usability issue -
870 #    that of being able to turn off certain filters.
872 # Revision 1.27  2001/10/20 23:44:27  richard
873 # Hyperdatabase sorts strings-that-look-like-numbers as numbers now.
875 # Revision 1.26  2001/10/16 03:48:01  richard
876 # admin tool now complains if a "find" is attempted with a non-link property.
878 # Revision 1.25  2001/10/11 00:17:51  richard
879 # Reverted a change in hyperdb so the default value for missing property
880 # values in a create() is None and not '' (the empty string.) This obviously
881 # breaks CSV import/export - the string 'None' will be created in an
882 # export/import operation.
884 # Revision 1.24  2001/10/10 03:54:57  richard
885 # Added database importing and exporting through CSV files.
886 # Uses the csv module from object-craft for exporting if it's available.
887 # Requires the csv module for importing.
889 # Revision 1.23  2001/10/09 23:58:10  richard
890 # Moved the data stringification up into the hyperdb.Class class' get, set
891 # and create methods. This means that the data is also stringified for the
892 # journal call, and removes duplication of code from the backends. The
893 # backend code now only sees strings.
895 # Revision 1.22  2001/10/09 07:25:59  richard
896 # Added the Password property type. See "pydoc roundup.password" for
897 # implementation details. Have updated some of the documentation too.
899 # Revision 1.21  2001/10/05 02:23:24  richard
900 #  . roundup-admin create now prompts for property info if none is supplied
901 #    on the command-line.
902 #  . hyperdb Class getprops() method may now return only the mutable
903 #    properties.
904 #  . Login now uses cookies, which makes it a whole lot more flexible. We can
905 #    now support anonymous user access (read-only, unless there's an
906 #    "anonymous" user, in which case write access is permitted). Login
907 #    handling has been moved into cgi_client.Client.main()
908 #  . The "extended" schema is now the default in roundup init.
909 #  . The schemas have had their page headings modified to cope with the new
910 #    login handling. Existing installations should copy the interfaces.py
911 #    file from the roundup lib directory to their instance home.
912 #  . Incorrectly had a Bizar Software copyright on the cgitb.py module from
913 #    Ping - has been removed.
914 #  . Fixed a whole bunch of places in the CGI interface where we should have
915 #    been returning Not Found instead of throwing an exception.
916 #  . Fixed a deviation from the spec: trying to modify the 'id' property of
917 #    an item now throws an exception.
919 # Revision 1.20  2001/10/04 02:12:42  richard
920 # Added nicer command-line item adding: passing no arguments will enter an
921 # interactive more which asks for each property in turn. While I was at it, I
922 # fixed an implementation problem WRT the spec - I wasn't raising a
923 # ValueError if the key property was missing from a create(). Also added a
924 # protected=boolean argument to getprops() so we can list only the mutable
925 # properties (defaults to yes, which lists the immutables).
927 # Revision 1.19  2001/08/29 04:47:18  richard
928 # Fixed CGI client change messages so they actually include the properties
929 # changed (again).
931 # Revision 1.18  2001/08/16 07:34:59  richard
932 # better CGI text searching - but hidden filter fields are disappearing...
934 # Revision 1.17  2001/08/16 06:59:58  richard
935 # all searches use re now - and they're all case insensitive
937 # Revision 1.16  2001/08/15 23:43:18  richard
938 # Fixed some isFooTypes that I missed.
939 # Refactored some code in the CGI code.
941 # Revision 1.15  2001/08/12 06:32:36  richard
942 # using isinstance(blah, Foo) now instead of isFooType
944 # Revision 1.14  2001/08/07 00:24:42  richard
945 # stupid typo
947 # Revision 1.13  2001/08/07 00:15:51  richard
948 # Added the copyright/license notice to (nearly) all files at request of
949 # Bizar Software.
951 # Revision 1.12  2001/08/02 06:38:17  richard
952 # Roundupdb now appends "mailing list" information to its messages which
953 # include the e-mail address and web interface address. Templates may
954 # override this in their db classes to include specific information (support
955 # instructions, etc).
957 # Revision 1.11  2001/08/01 04:24:21  richard
958 # mailgw was assuming certain properties existed on the issues being created.
960 # Revision 1.10  2001/07/30 02:38:31  richard
961 # get() now has a default arg - for migration only.
963 # Revision 1.9  2001/07/29 09:28:23  richard
964 # Fixed sorting by clicking on column headings.
966 # Revision 1.8  2001/07/29 08:27:40  richard
967 # Fixed handling of passed-in values in form elements (ie. during a
968 # drill-down)
970 # Revision 1.7  2001/07/29 07:01:39  richard
971 # Added vim command to all source so that we don't get no steenkin' tabs :)
973 # Revision 1.6  2001/07/29 05:36:14  richard
974 # Cleanup of the link label generation.
976 # Revision 1.5  2001/07/29 04:05:37  richard
977 # Added the fabricated property "id".
979 # Revision 1.4  2001/07/27 06:25:35  richard
980 # Fixed some of the exceptions so they're the right type.
981 # Removed the str()-ification of node ids so we don't mask oopsy errors any
982 # more.
984 # Revision 1.3  2001/07/27 05:17:14  richard
985 # just some comments
987 # Revision 1.2  2001/07/22 12:09:32  richard
988 # Final commit of Grande Splite
990 # Revision 1.1  2001/07/22 11:58:35  richard
991 # More Grande Splite
994 # vim: set filetype=python ts=4 sw=4 et si