diff roundup/hyperdb.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 7181efddce66
line wrap: on
line diff
--- a/roundup/hyperdb.py	Sat Dec 01 07:17:50 2001 +0000
+++ b/roundup/hyperdb.py	Sun Dec 02 05:06:16 2001 +0000
@@ -15,14 +15,14 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: hyperdb.py,v 1.38 2001-12-01 07:17:50 richard Exp $
+# $Id: hyperdb.py,v 1.39 2001-12-02 05:06:16 richard Exp $
 
 __doc__ = """
 Hyperdatabase implementation, especially field types.
 """
 
 # standard python modules
-import cPickle, re, string
+import cPickle, re, string, weakref
 
 # roundup modules
 import date, password
@@ -96,7 +96,7 @@
         """
         self.classname = classname
         self.properties = properties
-        self.db = db
+        self.db = weakref.proxy(db)       # use a weak ref to avoid circularity
         self.key = ''
 
         # do the db-related init stuff
@@ -495,7 +495,6 @@
                 continue
             if node[self.key] == keyvalue:
                 return nodeid
-        cldb.close()
         raise KeyError, keyvalue
 
     # XXX: change from spec - allows multiple props to match
@@ -532,7 +531,6 @@
                     l.append(id)
                 elif isinstance(prop, Multilink) and nodeid in property:
                     l.append(id)
-        cldb.close()
         return l
 
     def stringFind(self, **requirements):
@@ -559,7 +557,6 @@
                     break
             else:
                 l.append(nodeid)
-        cldb.close()
         return l
 
     def list(self):
@@ -573,7 +570,6 @@
                 continue
             l.append(nodeid)
         l.sort()
-        cldb.close()
         return l
 
     # XXX not in spec
@@ -666,7 +662,6 @@
             else:
                 l.append((nodeid, node))
         l.sort()
-        cldb.close()
 
         # optimise sort
         m = []
@@ -873,6 +868,15 @@
 
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.38  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.37  2001/11/28 21:55:35  richard
 #  . login_action and newuser_action return values were being ignored
 #  . Woohoo! Found that bloody re-login bug that was killing the mail

Roundup Issue Tracker: http://roundup-tracker.org/