5761e1d872ece31fda8fbd6bd86e3b6260e8a679
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.64 2002-05-15 06:21:21 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
111 #
112 # the base Database class
113 #
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.
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 = []
322 #
323 # The base Class class
324 #
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.
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.
361 Any other properties on this class that are missing from the
362 'propvalues' dictionary are set to None.
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.
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, 'link value must be String'
612 if not num_re.match(entry):
613 try:
614 entry = self.db.classes[link_class].lookup(entry)
615 except (TypeError, KeyError):
616 raise IndexError, 'new property "%s": %s not a %s'%(
617 key, entry, self.properties[key].classname)
618 l.append(entry)
619 value = l
620 propvalues[key] = value
622 # handle removals
623 if node.has_key(key):
624 l = node[key]
625 else:
626 l = []
627 for id in l[:]:
628 if id in value:
629 continue
630 # register the unlink with the old linked node
631 if self.properties[key].do_journal:
632 self.db.addjournal(link_class, id, 'unlink',
633 (self.classname, nodeid, key))
634 l.remove(id)
636 # handle additions
637 for id in value:
638 if not self.db.hasnode(link_class, id):
639 raise IndexError, '%s has no node %s'%(
640 link_class, id)
641 if id in l:
642 continue
643 # register the link with the newly linked node
644 if self.properties[key].do_journal:
645 self.db.addjournal(link_class, id, 'link',
646 (self.classname, nodeid, key))
647 l.append(id)
649 elif isinstance(prop, String):
650 if value is not None and type(value) != type(''):
651 raise TypeError, 'new property "%s" not a string'%key
653 elif isinstance(prop, Password):
654 if not isinstance(value, password.Password):
655 raise TypeError, 'new property "%s" not a Password'% key
656 propvalues[key] = value
658 elif value is not None and isinstance(prop, Date):
659 if not isinstance(value, date.Date):
660 raise TypeError, 'new property "%s" not a Date'% key
661 propvalues[key] = value
663 elif value is not None and isinstance(prop, Interval):
664 if not isinstance(value, date.Interval):
665 raise TypeError, 'new property "%s" not an Interval'% key
666 propvalues[key] = value
668 node[key] = value
670 # nothing to do?
671 if not propvalues:
672 return
674 # do the set, and journal it
675 self.db.setnode(self.classname, nodeid, node)
676 self.db.addjournal(self.classname, nodeid, 'set', propvalues)
678 def retire(self, nodeid):
679 """Retire a node.
681 The properties on the node remain available from the get() method,
682 and the node's id is never reused.
684 Retired nodes are not returned by the find(), list(), or lookup()
685 methods, and other nodes may reuse the values of their key properties.
686 """
687 if self.db.journaltag is None:
688 raise DatabaseError, 'Database open read-only'
689 node = self.db.getnode(self.classname, nodeid)
690 node[self.db.RETIRED_FLAG] = 1
691 self.db.setnode(self.classname, nodeid, node)
692 self.db.addjournal(self.classname, nodeid, 'retired', None)
694 def history(self, nodeid):
695 """Retrieve the journal of edits on a particular node.
697 'nodeid' must be the id of an existing node of this class or an
698 IndexError is raised.
700 The returned list contains tuples of the form
702 (date, tag, action, params)
704 'date' is a Timestamp object specifying the time of the change and
705 'tag' is the journaltag specified when the database was opened.
706 """
707 return self.db.getjournal(self.classname, nodeid)
709 # Locating nodes:
710 def hasnode(self, nodeid):
711 '''Determine if the given nodeid actually exists
712 '''
713 return self.db.hasnode(self.classname, nodeid)
715 def setkey(self, propname):
716 """Select a String property of this class to be the key property.
718 'propname' must be the name of a String property of this class or
719 None, or a TypeError is raised. The values of the key property on
720 all existing nodes must be unique or a ValueError is raised.
721 """
722 # TODO: validate that the property is a String!
723 self.key = propname
725 def getkey(self):
726 """Return the name of the key property for this class or None."""
727 return self.key
729 def labelprop(self, default_to_id=0):
730 ''' Return the property name for a label for the given node.
732 This method attempts to generate a consistent label for the node.
733 It tries the following in order:
734 1. key property
735 2. "name" property
736 3. "title" property
737 4. first property from the sorted property name list
738 '''
739 k = self.getkey()
740 if k:
741 return k
742 props = self.getprops()
743 if props.has_key('name'):
744 return 'name'
745 elif props.has_key('title'):
746 return 'title'
747 if default_to_id:
748 return 'id'
749 props = props.keys()
750 props.sort()
751 return props[0]
753 # TODO: set up a separate index db file for this? profile?
754 def lookup(self, keyvalue):
755 """Locate a particular node by its key property and return its id.
757 If this class has no key property, a TypeError is raised. If the
758 'keyvalue' matches one of the values for the key property among
759 the nodes in this class, the matching node's id is returned;
760 otherwise a KeyError is raised.
761 """
762 cldb = self.db.getclassdb(self.classname)
763 for nodeid in self.db.getnodeids(self.classname, cldb):
764 node = self.db.getnode(self.classname, nodeid, cldb)
765 if node.has_key(self.db.RETIRED_FLAG):
766 continue
767 if node[self.key] == keyvalue:
768 return nodeid
769 raise KeyError, keyvalue
771 # XXX: change from spec - allows multiple props to match
772 def find(self, **propspec):
773 """Get the ids of nodes in this class which link to a given node.
775 'propspec' consists of keyword args propname=nodeid
776 'propname' must be the name of a property in this class, or a
777 KeyError is raised. That property must be a Link or Multilink
778 property, or a TypeError is raised.
780 'nodeid' must be the id of an existing node in the class linked
781 to by the given property, or an IndexError is raised.
782 """
783 propspec = propspec.items()
784 for propname, nodeid in propspec:
785 # check the prop is OK
786 prop = self.properties[propname]
787 if not isinstance(prop, Link) and not isinstance(prop, Multilink):
788 raise TypeError, "'%s' not a Link/Multilink property"%propname
789 if not self.db.hasnode(prop.classname, nodeid):
790 raise ValueError, '%s has no node %s'%(prop.classname, nodeid)
792 # ok, now do the find
793 cldb = self.db.getclassdb(self.classname)
794 l = []
795 for id in self.db.getnodeids(self.classname, cldb):
796 node = self.db.getnode(self.classname, id, cldb)
797 if node.has_key(self.db.RETIRED_FLAG):
798 continue
799 for propname, nodeid in propspec:
800 property = node[propname]
801 if isinstance(prop, Link) and nodeid == property:
802 l.append(id)
803 elif isinstance(prop, Multilink) and nodeid in property:
804 l.append(id)
805 return l
807 def stringFind(self, **requirements):
808 """Locate a particular node by matching a set of its String
809 properties in a caseless search.
811 If the property is not a String property, a TypeError is raised.
813 The return is a list of the id of all nodes that match.
814 """
815 for propname in requirements.keys():
816 prop = self.properties[propname]
817 if isinstance(not prop, String):
818 raise TypeError, "'%s' not a String property"%propname
819 requirements[propname] = requirements[propname].lower()
820 l = []
821 cldb = self.db.getclassdb(self.classname)
822 for nodeid in self.db.getnodeids(self.classname, cldb):
823 node = self.db.getnode(self.classname, nodeid, cldb)
824 if node.has_key(self.db.RETIRED_FLAG):
825 continue
826 for key, value in requirements.items():
827 if node[key] and node[key].lower() != value:
828 break
829 else:
830 l.append(nodeid)
831 return l
833 def list(self):
834 """Return a list of the ids of the active nodes in this class."""
835 l = []
836 cn = self.classname
837 cldb = self.db.getclassdb(cn)
838 for nodeid in self.db.getnodeids(cn, cldb):
839 node = self.db.getnode(cn, nodeid, cldb)
840 if node.has_key(self.db.RETIRED_FLAG):
841 continue
842 l.append(nodeid)
843 l.sort()
844 return l
846 # XXX not in spec
847 def filter(self, filterspec, sort, group, num_re = re.compile('^\d+$')):
848 ''' Return a list of the ids of the active nodes in this class that
849 match the 'filter' spec, sorted by the group spec and then the
850 sort spec
851 '''
852 cn = self.classname
854 # optimise filterspec
855 l = []
856 props = self.getprops()
857 for k, v in filterspec.items():
858 propclass = props[k]
859 if isinstance(propclass, Link):
860 if type(v) is not type([]):
861 v = [v]
862 # replace key values with node ids
863 u = []
864 link_class = self.db.classes[propclass.classname]
865 for entry in v:
866 if entry == '-1': entry = None
867 elif not num_re.match(entry):
868 try:
869 entry = link_class.lookup(entry)
870 except (TypeError,KeyError):
871 raise ValueError, 'property "%s": %s not a %s'%(
872 k, entry, self.properties[k].classname)
873 u.append(entry)
875 l.append((0, k, u))
876 elif isinstance(propclass, Multilink):
877 if type(v) is not type([]):
878 v = [v]
879 # replace key values with node ids
880 u = []
881 link_class = self.db.classes[propclass.classname]
882 for entry in v:
883 if not num_re.match(entry):
884 try:
885 entry = link_class.lookup(entry)
886 except (TypeError,KeyError):
887 raise ValueError, 'new property "%s": %s not a %s'%(
888 k, entry, self.properties[k].classname)
889 u.append(entry)
890 l.append((1, k, u))
891 elif isinstance(propclass, String):
892 # simple glob searching
893 v = re.sub(r'([\|\{\}\\\.\+\[\]\(\)])', r'\\\1', v)
894 v = v.replace('?', '.')
895 v = v.replace('*', '.*?')
896 l.append((2, k, re.compile(v, re.I)))
897 else:
898 l.append((6, k, v))
899 filterspec = l
901 # now, find all the nodes that are active and pass filtering
902 l = []
903 cldb = self.db.getclassdb(cn)
904 for nodeid in self.db.getnodeids(cn, cldb):
905 node = self.db.getnode(cn, nodeid, cldb)
906 if node.has_key(self.db.RETIRED_FLAG):
907 continue
908 # apply filter
909 for t, k, v in filterspec:
910 # this node doesn't have this property, so reject it
911 if not node.has_key(k): break
913 if t == 0 and node[k] not in v:
914 # link - if this node'd property doesn't appear in the
915 # filterspec's nodeid list, skip it
916 break
917 elif t == 1:
918 # multilink - if any of the nodeids required by the
919 # filterspec aren't in this node's property, then skip
920 # it
921 for value in v:
922 if value not in node[k]:
923 break
924 else:
925 continue
926 break
927 elif t == 2 and (node[k] is None or not v.search(node[k])):
928 # RE search
929 break
930 elif t == 6 and node[k] != v:
931 # straight value comparison for the other types
932 break
933 else:
934 l.append((nodeid, node))
935 l.sort()
937 # optimise sort
938 m = []
939 for entry in sort:
940 if entry[0] != '-':
941 m.append(('+', entry))
942 else:
943 m.append((entry[0], entry[1:]))
944 sort = m
946 # optimise group
947 m = []
948 for entry in group:
949 if entry[0] != '-':
950 m.append(('+', entry))
951 else:
952 m.append((entry[0], entry[1:]))
953 group = m
954 # now, sort the result
955 def sortfun(a, b, sort=sort, group=group, properties=self.getprops(),
956 db = self.db, cl=self):
957 a_id, an = a
958 b_id, bn = b
959 # sort by group and then sort
960 for list in group, sort:
961 for dir, prop in list:
962 # sorting is class-specific
963 propclass = properties[prop]
965 # handle the properties that might be "faked"
966 # also, handle possible missing properties
967 try:
968 if not an.has_key(prop):
969 an[prop] = cl.get(a_id, prop)
970 av = an[prop]
971 except KeyError:
972 # the node doesn't have a value for this property
973 if isinstance(propclass, Multilink): av = []
974 else: av = ''
975 try:
976 if not bn.has_key(prop):
977 bn[prop] = cl.get(b_id, prop)
978 bv = bn[prop]
979 except KeyError:
980 # the node doesn't have a value for this property
981 if isinstance(propclass, Multilink): bv = []
982 else: bv = ''
984 # String and Date values are sorted in the natural way
985 if isinstance(propclass, String):
986 # clean up the strings
987 if av and av[0] in string.uppercase:
988 av = an[prop] = av.lower()
989 if bv and bv[0] in string.uppercase:
990 bv = bn[prop] = bv.lower()
991 if (isinstance(propclass, String) or
992 isinstance(propclass, Date)):
993 # it might be a string that's really an integer
994 try:
995 av = int(av)
996 bv = int(bv)
997 except:
998 pass
999 if dir == '+':
1000 r = cmp(av, bv)
1001 if r != 0: return r
1002 elif dir == '-':
1003 r = cmp(bv, av)
1004 if r != 0: return r
1006 # Link properties are sorted according to the value of
1007 # the "order" property on the linked nodes if it is
1008 # present; or otherwise on the key string of the linked
1009 # nodes; or finally on the node ids.
1010 elif isinstance(propclass, Link):
1011 link = db.classes[propclass.classname]
1012 if av is None and bv is not None: return -1
1013 if av is not None and bv is None: return 1
1014 if av is None and bv is None: continue
1015 if link.getprops().has_key('order'):
1016 if dir == '+':
1017 r = cmp(link.get(av, 'order'),
1018 link.get(bv, 'order'))
1019 if r != 0: return r
1020 elif dir == '-':
1021 r = cmp(link.get(bv, 'order'),
1022 link.get(av, 'order'))
1023 if r != 0: return r
1024 elif link.getkey():
1025 key = link.getkey()
1026 if dir == '+':
1027 r = cmp(link.get(av, key), link.get(bv, key))
1028 if r != 0: return r
1029 elif dir == '-':
1030 r = cmp(link.get(bv, key), link.get(av, key))
1031 if r != 0: return r
1032 else:
1033 if dir == '+':
1034 r = cmp(av, bv)
1035 if r != 0: return r
1036 elif dir == '-':
1037 r = cmp(bv, av)
1038 if r != 0: return r
1040 # Multilink properties are sorted according to how many
1041 # links are present.
1042 elif isinstance(propclass, Multilink):
1043 if dir == '+':
1044 r = cmp(len(av), len(bv))
1045 if r != 0: return r
1046 elif dir == '-':
1047 r = cmp(len(bv), len(av))
1048 if r != 0: return r
1049 # end for dir, prop in list:
1050 # end for list in sort, group:
1051 # if all else fails, compare the ids
1052 return cmp(a[0], b[0])
1054 l.sort(sortfun)
1055 return [i[0] for i in l]
1057 def count(self):
1058 """Get the number of nodes in this class.
1060 If the returned integer is 'numnodes', the ids of all the nodes
1061 in this class run from 1 to numnodes, and numnodes+1 will be the
1062 id of the next node to be created in this class.
1063 """
1064 return self.db.countnodes(self.classname)
1066 # Manipulating properties:
1068 def getprops(self, protected=1):
1069 """Return a dictionary mapping property names to property objects.
1070 If the "protected" flag is true, we include protected properties -
1071 those which may not be modified."""
1072 d = self.properties.copy()
1073 if protected:
1074 d['id'] = String()
1075 return d
1077 def addprop(self, **properties):
1078 """Add properties to this class.
1080 The keyword arguments in 'properties' must map names to property
1081 objects, or a TypeError is raised. None of the keys in 'properties'
1082 may collide with the names of existing properties, or a ValueError
1083 is raised before any properties have been added.
1084 """
1085 for key in properties.keys():
1086 if self.properties.has_key(key):
1087 raise ValueError, key
1088 self.properties.update(properties)
1090 # XXX not in spec
1091 class Node:
1092 ''' A convenience wrapper for the given node
1093 '''
1094 def __init__(self, cl, nodeid, cache=1):
1095 self.__dict__['cl'] = cl
1096 self.__dict__['nodeid'] = nodeid
1097 self.__dict__['cache'] = cache
1098 def keys(self, protected=1):
1099 return self.cl.getprops(protected=protected).keys()
1100 def values(self, protected=1):
1101 l = []
1102 for name in self.cl.getprops(protected=protected).keys():
1103 l.append(self.cl.get(self.nodeid, name, cache=self.cache))
1104 return l
1105 def items(self, protected=1):
1106 l = []
1107 for name in self.cl.getprops(protected=protected).keys():
1108 l.append((name, self.cl.get(self.nodeid, name, cache=self.cache)))
1109 return l
1110 def has_key(self, name):
1111 return self.cl.getprops().has_key(name)
1112 def __getattr__(self, name):
1113 if self.__dict__.has_key(name):
1114 return self.__dict__[name]
1115 try:
1116 return self.cl.get(self.nodeid, name, cache=self.cache)
1117 except KeyError, value:
1118 # we trap this but re-raise it as AttributeError - all other
1119 # exceptions should pass through untrapped
1120 pass
1121 # nope, no such attribute
1122 raise AttributeError, str(value)
1123 def __getitem__(self, name):
1124 return self.cl.get(self.nodeid, name, cache=self.cache)
1125 def __setattr__(self, name, value):
1126 try:
1127 return self.cl.set(self.nodeid, **{name: value})
1128 except KeyError, value:
1129 raise AttributeError, str(value)
1130 def __setitem__(self, name, value):
1131 self.cl.set(self.nodeid, **{name: value})
1132 def history(self):
1133 return self.cl.history(self.nodeid)
1134 def retire(self):
1135 return self.cl.retire(self.nodeid)
1138 def Choice(name, db, *options):
1139 '''Quick helper to create a simple class with choices
1140 '''
1141 cl = Class(db, name, name=String(), order=String())
1142 for i in range(len(options)):
1143 cl.create(name=options[i], order=i)
1144 return hyperdb.Link(name)
1146 #
1147 # $Log: not supported by cvs2svn $
1148 # Revision 1.63 2002/04/15 23:25:15 richard
1149 # . node ids are now generated from a lockable store - no more race conditions
1150 #
1151 # We're using the portalocker code by Jonathan Feinberg that was contributed
1152 # to the ASPN Python cookbook. This gives us locking across Unix and Windows.
1153 #
1154 # Revision 1.62 2002/04/03 07:05:50 richard
1155 # d'oh! killed retirement of nodes :(
1156 # all better now...
1157 #
1158 # Revision 1.61 2002/04/03 06:11:51 richard
1159 # Fix for old databases that contain properties that don't exist any more.
1160 #
1161 # Revision 1.60 2002/04/03 05:54:31 richard
1162 # Fixed serialisation problem by moving the serialisation step out of the
1163 # hyperdb.Class (get, set) into the hyperdb.Database.
1164 #
1165 # Also fixed htmltemplate after the showid changes I made yesterday.
1166 #
1167 # Unit tests for all of the above written.
1168 #
1169 # Revision 1.59 2002/03/12 22:52:26 richard
1170 # more pychecker warnings removed
1171 #
1172 # Revision 1.58 2002/02/27 03:23:16 richard
1173 # Ran it through pychecker, made fixes
1174 #
1175 # Revision 1.57 2002/02/20 05:23:24 richard
1176 # Didn't accomodate new values for new properties
1177 #
1178 # Revision 1.56 2002/02/20 05:05:28 richard
1179 # . Added simple editing for classes that don't define a templated interface.
1180 # - access using the admin "class list" interface
1181 # - limited to admin-only
1182 # - requires the csv module from object-craft (url given if it's missing)
1183 #
1184 # Revision 1.55 2002/02/15 07:27:12 richard
1185 # Oops, precedences around the way w0rng.
1186 #
1187 # Revision 1.54 2002/02/15 07:08:44 richard
1188 # . Alternate email addresses are now available for users. See the MIGRATION
1189 # file for info on how to activate the feature.
1190 #
1191 # Revision 1.53 2002/01/22 07:21:13 richard
1192 # . fixed back_bsddb so it passed the journal tests
1193 #
1194 # ... it didn't seem happy using the back_anydbm _open method, which is odd.
1195 # Yet another occurrance of whichdb not being able to recognise older bsddb
1196 # databases. Yadda yadda. Made the HYPERDBDEBUG stuff more sane in the
1197 # process.
1198 #
1199 # Revision 1.52 2002/01/21 16:33:19 rochecompaan
1200 # You can now use the roundup-admin tool to pack the database
1201 #
1202 # Revision 1.51 2002/01/21 03:01:29 richard
1203 # brief docco on the do_journal argument
1204 #
1205 # Revision 1.50 2002/01/19 13:16:04 rochecompaan
1206 # Journal entries for link and multilink properties can now be switched on
1207 # or off.
1208 #
1209 # Revision 1.49 2002/01/16 07:02:57 richard
1210 # . lots of date/interval related changes:
1211 # - more relaxed date format for input
1212 #
1213 # Revision 1.48 2002/01/14 06:32:34 richard
1214 # . #502951 ] adding new properties to old database
1215 #
1216 # Revision 1.47 2002/01/14 02:20:15 richard
1217 # . changed all config accesses so they access either the instance or the
1218 # config attriubute on the db. This means that all config is obtained from
1219 # instance_config instead of the mish-mash of classes. This will make
1220 # switching to a ConfigParser setup easier too, I hope.
1221 #
1222 # At a minimum, this makes migration a _little_ easier (a lot easier in the
1223 # 0.5.0 switch, I hope!)
1224 #
1225 # Revision 1.46 2002/01/07 10:42:23 richard
1226 # oops
1227 #
1228 # Revision 1.45 2002/01/02 04:18:17 richard
1229 # hyperdb docstrings
1230 #
1231 # Revision 1.44 2002/01/02 02:31:38 richard
1232 # Sorry for the huge checkin message - I was only intending to implement #496356
1233 # but I found a number of places where things had been broken by transactions:
1234 # . modified ROUNDUPDBSENDMAILDEBUG to be SENDMAILDEBUG and hold a filename
1235 # for _all_ roundup-generated smtp messages to be sent to.
1236 # . the transaction cache had broken the roundupdb.Class set() reactors
1237 # . newly-created author users in the mailgw weren't being committed to the db
1238 #
1239 # Stuff that made it into CHANGES.txt (ie. the stuff I was actually working
1240 # on when I found that stuff :):
1241 # . #496356 ] Use threading in messages
1242 # . detectors were being registered multiple times
1243 # . added tests for mailgw
1244 # . much better attaching of erroneous messages in the mail gateway
1245 #
1246 # Revision 1.43 2001/12/20 06:13:24 rochecompaan
1247 # Bugs fixed:
1248 # . Exception handling in hyperdb for strings-that-look-like numbers got
1249 # lost somewhere
1250 # . Internet Explorer submits full path for filename - we now strip away
1251 # the path
1252 # Features added:
1253 # . Link and multilink properties are now displayed sorted in the cgi
1254 # interface
1255 #
1256 # Revision 1.42 2001/12/16 10:53:37 richard
1257 # take a copy of the node dict so that the subsequent set
1258 # operation doesn't modify the oldvalues structure
1259 #
1260 # Revision 1.41 2001/12/15 23:47:47 richard
1261 # Cleaned up some bare except statements
1262 #
1263 # Revision 1.40 2001/12/14 23:42:57 richard
1264 # yuck, a gdbm instance tests false :(
1265 # I've left the debugging code in - it should be removed one day if we're ever
1266 # _really_ anal about performace :)
1267 #
1268 # Revision 1.39 2001/12/02 05:06:16 richard
1269 # . We now use weakrefs in the Classes to keep the database reference, so
1270 # the close() method on the database is no longer needed.
1271 # I bumped the minimum python requirement up to 2.1 accordingly.
1272 # . #487480 ] roundup-server
1273 # . #487476 ] INSTALL.txt
1274 #
1275 # I also cleaned up the change message / post-edit stuff in the cgi client.
1276 # There's now a clearly marked "TODO: append the change note" where I believe
1277 # the change note should be added there. The "changes" list will obviously
1278 # have to be modified to be a dict of the changes, or somesuch.
1279 #
1280 # More testing needed.
1281 #
1282 # Revision 1.38 2001/12/01 07:17:50 richard
1283 # . We now have basic transaction support! Information is only written to
1284 # the database when the commit() method is called. Only the anydbm
1285 # backend is modified in this way - neither of the bsddb backends have been.
1286 # The mail, admin and cgi interfaces all use commit (except the admin tool
1287 # doesn't have a commit command, so interactive users can't commit...)
1288 # . Fixed login/registration forwarding the user to the right page (or not,
1289 # on a failure)
1290 #
1291 # Revision 1.37 2001/11/28 21:55:35 richard
1292 # . login_action and newuser_action return values were being ignored
1293 # . Woohoo! Found that bloody re-login bug that was killing the mail
1294 # gateway.
1295 # (also a minor cleanup in hyperdb)
1296 #
1297 # Revision 1.36 2001/11/27 03:16:09 richard
1298 # Another place that wasn't handling missing properties.
1299 #
1300 # Revision 1.35 2001/11/22 15:46:42 jhermann
1301 # Added module docstrings to all modules.
1302 #
1303 # Revision 1.34 2001/11/21 04:04:43 richard
1304 # *sigh* more missing value handling
1305 #
1306 # Revision 1.33 2001/11/21 03:40:54 richard
1307 # more new property handling
1308 #
1309 # Revision 1.32 2001/11/21 03:11:28 richard
1310 # Better handling of new properties.
1311 #
1312 # Revision 1.31 2001/11/12 22:01:06 richard
1313 # Fixed issues with nosy reaction and author copies.
1314 #
1315 # Revision 1.30 2001/11/09 10:11:08 richard
1316 # . roundup-admin now handles all hyperdb exceptions
1317 #
1318 # Revision 1.29 2001/10/27 00:17:41 richard
1319 # Made Class.stringFind() do caseless matching.
1320 #
1321 # Revision 1.28 2001/10/21 04:44:50 richard
1322 # bug #473124: UI inconsistency with Link fields.
1323 # This also prompted me to fix a fairly long-standing usability issue -
1324 # that of being able to turn off certain filters.
1325 #
1326 # Revision 1.27 2001/10/20 23:44:27 richard
1327 # Hyperdatabase sorts strings-that-look-like-numbers as numbers now.
1328 #
1329 # Revision 1.26 2001/10/16 03:48:01 richard
1330 # admin tool now complains if a "find" is attempted with a non-link property.
1331 #
1332 # Revision 1.25 2001/10/11 00:17:51 richard
1333 # Reverted a change in hyperdb so the default value for missing property
1334 # values in a create() is None and not '' (the empty string.) This obviously
1335 # breaks CSV import/export - the string 'None' will be created in an
1336 # export/import operation.
1337 #
1338 # Revision 1.24 2001/10/10 03:54:57 richard
1339 # Added database importing and exporting through CSV files.
1340 # Uses the csv module from object-craft for exporting if it's available.
1341 # Requires the csv module for importing.
1342 #
1343 # Revision 1.23 2001/10/09 23:58:10 richard
1344 # Moved the data stringification up into the hyperdb.Class class' get, set
1345 # and create methods. This means that the data is also stringified for the
1346 # journal call, and removes duplication of code from the backends. The
1347 # backend code now only sees strings.
1348 #
1349 # Revision 1.22 2001/10/09 07:25:59 richard
1350 # Added the Password property type. See "pydoc roundup.password" for
1351 # implementation details. Have updated some of the documentation too.
1352 #
1353 # Revision 1.21 2001/10/05 02:23:24 richard
1354 # . roundup-admin create now prompts for property info if none is supplied
1355 # on the command-line.
1356 # . hyperdb Class getprops() method may now return only the mutable
1357 # properties.
1358 # . Login now uses cookies, which makes it a whole lot more flexible. We can
1359 # now support anonymous user access (read-only, unless there's an
1360 # "anonymous" user, in which case write access is permitted). Login
1361 # handling has been moved into cgi_client.Client.main()
1362 # . The "extended" schema is now the default in roundup init.
1363 # . The schemas have had their page headings modified to cope with the new
1364 # login handling. Existing installations should copy the interfaces.py
1365 # file from the roundup lib directory to their instance home.
1366 # . Incorrectly had a Bizar Software copyright on the cgitb.py module from
1367 # Ping - has been removed.
1368 # . Fixed a whole bunch of places in the CGI interface where we should have
1369 # been returning Not Found instead of throwing an exception.
1370 # . Fixed a deviation from the spec: trying to modify the 'id' property of
1371 # an item now throws an exception.
1372 #
1373 # Revision 1.20 2001/10/04 02:12:42 richard
1374 # Added nicer command-line item adding: passing no arguments will enter an
1375 # interactive more which asks for each property in turn. While I was at it, I
1376 # fixed an implementation problem WRT the spec - I wasn't raising a
1377 # ValueError if the key property was missing from a create(). Also added a
1378 # protected=boolean argument to getprops() so we can list only the mutable
1379 # properties (defaults to yes, which lists the immutables).
1380 #
1381 # Revision 1.19 2001/08/29 04:47:18 richard
1382 # Fixed CGI client change messages so they actually include the properties
1383 # changed (again).
1384 #
1385 # Revision 1.18 2001/08/16 07:34:59 richard
1386 # better CGI text searching - but hidden filter fields are disappearing...
1387 #
1388 # Revision 1.17 2001/08/16 06:59:58 richard
1389 # all searches use re now - and they're all case insensitive
1390 #
1391 # Revision 1.16 2001/08/15 23:43:18 richard
1392 # Fixed some isFooTypes that I missed.
1393 # Refactored some code in the CGI code.
1394 #
1395 # Revision 1.15 2001/08/12 06:32:36 richard
1396 # using isinstance(blah, Foo) now instead of isFooType
1397 #
1398 # Revision 1.14 2001/08/07 00:24:42 richard
1399 # stupid typo
1400 #
1401 # Revision 1.13 2001/08/07 00:15:51 richard
1402 # Added the copyright/license notice to (nearly) all files at request of
1403 # Bizar Software.
1404 #
1405 # Revision 1.12 2001/08/02 06:38:17 richard
1406 # Roundupdb now appends "mailing list" information to its messages which
1407 # include the e-mail address and web interface address. Templates may
1408 # override this in their db classes to include specific information (support
1409 # instructions, etc).
1410 #
1411 # Revision 1.11 2001/08/01 04:24:21 richard
1412 # mailgw was assuming certain properties existed on the issues being created.
1413 #
1414 # Revision 1.10 2001/07/30 02:38:31 richard
1415 # get() now has a default arg - for migration only.
1416 #
1417 # Revision 1.9 2001/07/29 09:28:23 richard
1418 # Fixed sorting by clicking on column headings.
1419 #
1420 # Revision 1.8 2001/07/29 08:27:40 richard
1421 # Fixed handling of passed-in values in form elements (ie. during a
1422 # drill-down)
1423 #
1424 # Revision 1.7 2001/07/29 07:01:39 richard
1425 # Added vim command to all source so that we don't get no steenkin' tabs :)
1426 #
1427 # Revision 1.6 2001/07/29 05:36:14 richard
1428 # Cleanup of the link label generation.
1429 #
1430 # Revision 1.5 2001/07/29 04:05:37 richard
1431 # Added the fabricated property "id".
1432 #
1433 # Revision 1.4 2001/07/27 06:25:35 richard
1434 # Fixed some of the exceptions so they're the right type.
1435 # Removed the str()-ification of node ids so we don't mask oopsy errors any
1436 # more.
1437 #
1438 # Revision 1.3 2001/07/27 05:17:14 richard
1439 # just some comments
1440 #
1441 # Revision 1.2 2001/07/22 12:09:32 richard
1442 # Final commit of Grande Splite
1443 #
1444 # Revision 1.1 2001/07/22 11:58:35 richard
1445 # More Grande Splite
1446 #
1447 #
1448 # vim: set filetype=python ts=4 sw=4 et si