1414# FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
1515# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
17- #
18- #$Id: back_anydbm.py,v 1.171 2004-07-28 05:00:31 richard Exp $
17+ #
18+ #$Id: back_anydbm.py,v 1.172 2004-09-29 07:09:13 a1s Exp $
1919'''This module defines a backend that saves the hyperdatabase in a
2020database chosen by anydbm. It is guaranteed to always be available in python
2121versions >2.1.1 (the dumbdbm fallback in 2.1.1 and earlier has several
@@ -60,7 +60,7 @@ class Database(FileStorage, hyperdb.Database, roundupdb.Database):
6060 '''A database for storing records containing flexible data types.
6161
6262 Transaction stuff TODO:
63-
63+
6464 - check the timestamp of the class file and nuke the cache if it's
6565 modified. Do some sort of conflict checking on the dirty stuff.
6666 - perhaps detect write collisions (related to above)?
@@ -78,8 +78,8 @@ def __init__(self, config, journaltag=None):
7878 entries for any edits done on the database. If 'journaltag' is
7979 None, the database is opened in read-only mode: the Class.create(),
8080 Class.set(), Class.retire(), and Class.restore() methods are
81- disabled.
82- '''
81+ disabled.
82+ '''
8383 self .config , self .journaltag = config , journaltag
8484 self .dir = config .DATABASE
8585 self .classes = {}
@@ -130,7 +130,7 @@ def reindex(self, classname=None):
130130 self .indexer .save_index ()
131131
132132 def __repr__ (self ):
133- return '<back_anydbm instance at %x>' % id (self )
133+ return '<back_anydbm instance at %x>' % id (self )
134134
135135 #
136136 # Classes
@@ -553,7 +553,7 @@ def pack(self, pack_before):
553553 last_set_entry = None
554554 for entry in journal :
555555 # unpack the entry
556- (nodeid , date_stamp , self .journaltag , action ,
556+ (nodeid , date_stamp , self .journaltag , action ,
557557 params ) = entry
558558 # if the entry is after the pack date, _or_ the initial
559559 # create entry, then it stays
@@ -569,7 +569,7 @@ def pack(self, pack_before):
569569 if db_type == 'gdbm' :
570570 db .reorganize ()
571571 db .close ()
572-
572+
573573
574574 #
575575 # Basic transaction support
@@ -771,13 +771,13 @@ def create(self, **propvalues):
771771
772772 The values of arguments must be acceptable for the types of their
773773 corresponding properties or a TypeError is raised.
774-
774+
775775 If this class has a key property, it must be present and its value
776776 must not collide with other key strings or a ValueError is raised.
777-
777+
778778 Any other properties on this class that are missing from the
779779 'propvalues' dictionary are set to None.
780-
780+
781781 If an id in a link or multilink property does not refer to a valid
782782 node, an IndexError is raised.
783783
@@ -1022,7 +1022,7 @@ def get(self, nodeid, propname, default=_marker, cache=1):
10221022
10231023 def set (self , nodeid , ** propvalues ):
10241024 '''Modify a property on an existing node of this class.
1025-
1025+
10261026 'nodeid' must be the id of an existing node of this class or an
10271027 IndexError is raised.
10281028
@@ -1052,7 +1052,7 @@ class or a KeyError is raised.
10521052 oldvalues [name ] = None
10531053 propvalues = self .set_inner (nodeid , ** propvalues )
10541054 self .fireReactors ('set' , nodeid , oldvalues )
1055- return propvalues
1055+ return propvalues
10561056
10571057 def set_inner (self , nodeid , ** propvalues ):
10581058 ''' Called by set, in-between the audit and react calls.
@@ -1246,10 +1246,10 @@ def set_inner(self, nodeid, **propvalues):
12461246
12471247 def retire (self , nodeid ):
12481248 '''Retire a node.
1249-
1249+
12501250 The properties on the node remain available from the get() method,
12511251 and the node's id is never reused.
1252-
1252+
12531253 Retired nodes are not returned by the find(), list(), or lookup()
12541254 methods, and other nodes may reuse the values of their key properties.
12551255
@@ -1482,7 +1482,7 @@ def stringFind(self, **requirements):
14821482 properties in a caseless search.
14831483
14841484 If the property is not a String property, a TypeError is raised.
1485-
1485+
14861486 The return is a list of the id of all nodes that match.
14871487 '''
14881488 for propname in requirements .keys ():
@@ -1577,7 +1577,7 @@ def filter(self, search_matches, filterspec, sort=(None,None),
15771577 DATE = 'spec:date'
15781578 INTERVAL = 'spec:interval'
15791579 OTHER = 'spec:other'
1580-
1580+
15811581 timezone = self .db .getUserTimezone ()
15821582 for k , v in filterspec .items ():
15831583 propclass = props [k ]
@@ -1624,7 +1624,7 @@ def filter(self, search_matches, filterspec, sort=(None,None),
16241624 except ValueError :
16251625 # If range creation fails - ignore that search parameter
16261626 pass
1627-
1627+
16281628 elif isinstance (propclass , Boolean ):
16291629 if type (v ) != type ([]):
16301630 v = v .split (',' )
@@ -2023,7 +2023,7 @@ def export_journals(self):
20232023
20242024 def import_journals (self , entries ):
20252025 '''Import a class's journal.
2026-
2026+
20272027 Uses setjournal() to set the journal for each item.'''
20282028 properties = self .getprops ()
20292029 d = {}
@@ -2193,4 +2193,4 @@ def __init__(self, db, classname, **properties):
21932193 properties ['superseder' ] = hyperdb .Multilink (classname )
21942194 Class .__init__ (self , db , classname , ** properties )
21952195
2196- #
2196+ # vim: set et sts=4 sw=4 :
0 commit comments