Mercurial > p > roundup > code
comparison roundup/hyperdb.py @ 910:299f4890427d
documentation reorg post-new-security
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Mon, 29 Jul 2002 23:30:14 +0000 |
| parents | cbefecea6c74 |
| children | 301a02ea6020 |
comparison
equal
deleted
inserted
replaced
| 909:ef9c759c243e | 910:299f4890427d |
|---|---|
| 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 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" | 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, | 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 17 # | 17 # |
| 18 # $Id: hyperdb.py,v 1.78 2002-07-21 03:26:37 richard Exp $ | 18 # $Id: hyperdb.py,v 1.79 2002-07-29 23:30:14 richard Exp $ |
| 19 | 19 |
| 20 __doc__ = """ | 20 __doc__ = """ |
| 21 Hyperdatabase implementation, especially field types. | 21 Hyperdatabase implementation, especially field types. |
| 22 """ | 22 """ |
| 23 | 23 |
| 169 ''' | 169 ''' |
| 170 | 170 |
| 171 # flag to set on retired entries | 171 # flag to set on retired entries |
| 172 RETIRED_FLAG = '__hyperdb_retired' | 172 RETIRED_FLAG = '__hyperdb_retired' |
| 173 | 173 |
| 174 # XXX deviates from spec: storagelocator is obtained from the config | |
| 175 def __init__(self, config, journaltag=None): | 174 def __init__(self, config, journaltag=None): |
| 176 """Open a hyperdatabase given a specifier to some storage. | 175 """Open a hyperdatabase given a specifier to some storage. |
| 177 | 176 |
| 178 The 'storagelocator' is obtained from config.DATABASE. | 177 The 'storagelocator' is obtained from config.DATABASE. |
| 179 The meaning of 'storagelocator' depends on the particular | 178 The meaning of 'storagelocator' depends on the particular |
| 371 determine what its values prior to modification are, you need to | 370 determine what its values prior to modification are, you need to |
| 372 set cache=0. | 371 set cache=0. |
| 373 """ | 372 """ |
| 374 raise NotImplementedError | 373 raise NotImplementedError |
| 375 | 374 |
| 376 # XXX not in spec | |
| 377 def getnode(self, nodeid, cache=1): | 375 def getnode(self, nodeid, cache=1): |
| 378 ''' Return a convenience wrapper for the node. | 376 ''' Return a convenience wrapper for the node. |
| 379 | 377 |
| 380 'nodeid' must be the id of an existing node of this class or an | 378 'nodeid' must be the id of an existing node of this class or an |
| 381 IndexError is raised. | 379 IndexError is raised. |
| 490 the nodes in this class, the matching node's id is returned; | 488 the nodes in this class, the matching node's id is returned; |
| 491 otherwise a KeyError is raised. | 489 otherwise a KeyError is raised. |
| 492 """ | 490 """ |
| 493 raise NotImplementedError | 491 raise NotImplementedError |
| 494 | 492 |
| 495 # XXX: change from spec - allows multiple props to match | |
| 496 def find(self, **propspec): | 493 def find(self, **propspec): |
| 497 """Get the ids of nodes in this class which link to the given nodes. | 494 """Get the ids of nodes in this class which link to the given nodes. |
| 498 | 495 |
| 499 'propspec' consists of keyword args propname={nodeid:1,} | 496 'propspec' consists of keyword args propname={nodeid:1,} |
| 500 'propname' must be the name of a property in this class, or a | 497 'propname' must be the name of a property in this class, or a |
| 508 | 505 |
| 509 db.issue.find(messages={'1':1,'3':1}, files={'7':1}) | 506 db.issue.find(messages={'1':1,'3':1}, files={'7':1}) |
| 510 """ | 507 """ |
| 511 raise NotImplementedError | 508 raise NotImplementedError |
| 512 | 509 |
| 513 # XXX not in spec | |
| 514 def filter(self, search_matches, filterspec, sort, group, | 510 def filter(self, search_matches, filterspec, sort, group, |
| 515 num_re = re.compile('^\d+$')): | 511 num_re = re.compile('^\d+$')): |
| 516 ''' Return a list of the ids of the active nodes in this class that | 512 ''' Return a list of the ids of the active nodes in this class that |
| 517 match the 'filter' spec, sorted by the group spec and then the | 513 match the 'filter' spec, sorted by the group spec and then the |
| 518 sort spec | 514 sort spec |
| 549 def index(self, nodeid): | 545 def index(self, nodeid): |
| 550 '''Add (or refresh) the node to search indexes | 546 '''Add (or refresh) the node to search indexes |
| 551 ''' | 547 ''' |
| 552 raise NotImplementedError | 548 raise NotImplementedError |
| 553 | 549 |
| 554 # XXX not in spec | |
| 555 class Node: | 550 class Node: |
| 556 ''' A convenience wrapper for the given node | 551 ''' A convenience wrapper for the given node |
| 557 ''' | 552 ''' |
| 558 def __init__(self, cl, nodeid, cache=1): | 553 def __init__(self, cl, nodeid, cache=1): |
| 559 self.__dict__['cl'] = cl | 554 self.__dict__['cl'] = cl |
| 607 cl.create(name=options[i], order=i) | 602 cl.create(name=options[i], order=i) |
| 608 return hyperdb.Link(name) | 603 return hyperdb.Link(name) |
| 609 | 604 |
| 610 # | 605 # |
| 611 # $Log: not supported by cvs2svn $ | 606 # $Log: not supported by cvs2svn $ |
| 607 # Revision 1.78 2002/07/21 03:26:37 richard | |
| 608 # Gordon, does this help? | |
| 609 # | |
| 612 # Revision 1.77 2002/07/18 11:27:47 richard | 610 # Revision 1.77 2002/07/18 11:27:47 richard |
| 613 # ws | 611 # ws |
| 614 # | 612 # |
| 615 # Revision 1.76 2002/07/18 11:17:30 gmcm | 613 # Revision 1.76 2002/07/18 11:17:30 gmcm |
| 616 # Add Number and Boolean types to hyperdb. | 614 # Add Number and Boolean types to hyperdb. |
