diff roundup/backends/rdbms_common.py @ 2082:c091cacdc505

Finished implementation of session and one-time-key stores for RDBMS backends. Refactored the API of sessions and their interaction with the backend database a fair bit too. Added some session tests. Nothing testing ageing yet, 'cos that's a pain inna ass to test :) Note: metakit backend still uses the *dbm implementation. It might want to implement its own session store some day, as it'll be faster than the *dbm one.
author Richard Jones <richard@users.sourceforge.net>
date Thu, 18 Mar 2004 01:58:46 +0000
parents fb4bf55b94d7
children 93f03c6714d8
line wrap: on
line diff
--- a/roundup/backends/rdbms_common.py	Wed Mar 17 22:01:37 2004 +0000
+++ b/roundup/backends/rdbms_common.py	Thu Mar 18 01:58:46 2004 +0000
@@ -1,4 +1,4 @@
-# $Id: rdbms_common.py,v 1.80 2004-03-17 22:01:37 richard Exp $
+# $Id: rdbms_common.py,v 1.81 2004-03-18 01:58:45 richard Exp $
 ''' Relational database (SQL) backend common code.
 
 Basics:
@@ -40,7 +40,7 @@
 # support
 from blobfiles import FileStorage
 from roundup.indexer import Indexer
-from sessions import Sessions, OneTimeKeys
+from sessions_rdbms import Sessions, OneTimeKeys
 from roundup.date import Range
 
 # number of rows to keep in memory
@@ -60,8 +60,6 @@
         self.dir = config.DATABASE
         self.classes = {}
         self.indexer = Indexer(self.dir)
-        self.sessions = Sessions(self.config)
-        self.otks = OneTimeKeys(self.config)
         self.security = security.Security(self)
 
         # additional transaction support for external files and the like
@@ -76,13 +74,19 @@
         self.lockfile = None
 
         # open a connection to the database, creating the "conn" attribute
-        self.sql_open_connection()
+        self.open_connection()
 
     def clearCache(self):
         self.cache = {}
         self.cache_lru = []
 
-    def sql_open_connection(self):
+    def getSessionManager(self):
+        return Sessions(self)
+
+    def getOTKManager(self):
+        return OneTimeKeys(self)
+
+    def open_connection(self):
         ''' Open a connection to the database, creating it if necessary.
 
             Must call self.load_dbschema()
@@ -1069,11 +1073,6 @@
         ''' Close off the connection.
         '''
         self.sql_close()
-        if self.lockfile is not None:
-            locking.release_lock(self.lockfile)
-        if self.lockfile is not None:
-            self.lockfile.close()
-            self.lockfile = None
 
 #
 # The base Class class

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