Mercurial > p > roundup > code
diff roundup/backends/back_anydbm.py @ 431:a28a80b714f9
Eliminate database close method by using weakrefs.
. We now use weakrefs in the Classes to keep the database reference, so
the close() method on the database is no longer needed.
I bumped the minimum python requirement up to 2.1 accordingly.
. [SF#487480] roundup-server
. [SF#487476] INSTALL.txt
I also cleaned up the change message / post-edit stuff in the cgi client.
There's now a clearly marked "TODO: append the change note" where I believe
the change note should be added there. The "changes" list will obviously
have to be modified to be a dict of the changes, or somesuch.
More testing needed.
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Sun, 02 Dec 2001 05:06:16 +0000 |
| parents | 350685601f37 |
| children | de5bf4191f11 |
line wrap: on
line diff
--- a/roundup/backends/back_anydbm.py Sat Dec 01 07:17:50 2001 +0000 +++ b/roundup/backends/back_anydbm.py Sun Dec 02 05:06:16 2001 +0000 @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -#$Id: back_anydbm.py,v 1.12 2001-12-01 07:17:50 richard Exp $ +#$Id: back_anydbm.py,v 1.13 2001-12-02 05:06:16 richard Exp $ import anydbm, os, marshal from roundup import hyperdb, date, password @@ -134,7 +134,6 @@ if not db.has_key(nodeid): raise IndexError, nodeid res = marshal.loads(db[nodeid]) - if not cldb: db.close() cache[nodeid] = res return res @@ -149,7 +148,6 @@ # not in the cache - check the database db = cldb or self.getclassdb(classname) res = db.has_key(nodeid) - if not cldb: db.close() return res def countnodes(self, classname, cldb=None): @@ -159,7 +157,6 @@ # and count those in the DB db = cldb or self.getclassdb(classname) count = count + len(db.keys()) - if not cldb: db.close() return count def getnodeids(self, classname, cldb=None): @@ -168,7 +165,6 @@ db = cldb or self.getclassdb(classname) res = res + db.keys() - if not cldb: db.close() return res # @@ -202,17 +198,8 @@ (nodeid, date_stamp, self.journaltag, action, params) = entry date_obj = date.Date(date_stamp) res.append((nodeid, date_obj, self.journaltag, action, params)) - db.close() return res - def close(self): - ''' Close the Database. - - Commit all data to the database and release circular refs so - the database is closed cleanly. - ''' - self.classes = {} - # # Basic transaction support @@ -222,7 +209,6 @@ ''' # lock the DB for method, args in self.transactions: - print method.__name__, args # TODO: optimise this, duh! method(*args) # unlock the DB @@ -262,6 +248,15 @@ # #$Log: not supported by cvs2svn $ +#Revision 1.12 2001/12/01 07:17:50 richard +#. We now have basic transaction support! Information is only written to +# the database when the commit() method is called. Only the anydbm +# backend is modified in this way - neither of the bsddb backends have been. +# The mail, admin and cgi interfaces all use commit (except the admin tool +# doesn't have a commit command, so interactive users can't commit...) +#. Fixed login/registration forwarding the user to the right page (or not, +# on a failure) +# #Revision 1.11 2001/11/21 02:34:18 richard #Added a target version field to the extended issue schema #
