[Zope-Checkins] CVS: Zope/lib/python/Shared/DC/ZRDB - Connection.py:1.35.68.2

Chris Withers cvs-admin at zope.org
Wed Oct 22 16:32:00 EDT 2003


Update of /cvs-repository/Zope/lib/python/Shared/DC/ZRDB
In directory cvs.zope.org:/tmp/cvs-serv16198

Modified Files:
      Tag: Zope-2_7-branch
	Connection.py 
Log Message:
Refactor, and check we have connection before we try and close it.


=== Zope/lib/python/Shared/DC/ZRDB/Connection.py 1.35.68.1 => 1.35.68.2 ===
--- Zope/lib/python/Shared/DC/ZRDB/Connection.py:1.35.68.1	Wed Sep 24 10:31:53 2003
+++ Zope/lib/python/Shared/DC/ZRDB/Connection.py	Wed Oct 22 16:32:00 2003
@@ -142,16 +142,19 @@
 
     manage_main=DTMLFile('dtml/connectionStatus', globals())
 
-    def manage_close_connection(self, REQUEST):
+    def manage_close_connection(self, REQUEST=None):
         " "
-        try: self._v_database_connection.close()
+        try: 
+            if hasattr(self,'_v_database_connection'):
+                self._v_database_connection.close()
         except:
             LOG('Shared.DC.ZRDB.Connection',
                 ERROR,
                 'Error closing relational database connection.',
                 error=exc_info())
         self._v_connected=''
-        return self.manage_main(self, REQUEST)
+        if REQUEST is not None:
+            return self.manage_main(self, REQUEST)
 
     def manage_open_connection(self, REQUEST=None):
         " "
@@ -169,13 +172,7 @@
                 '''The database connection is not connected''')
 
     def connect(self,s):
-        try: self._v_database_connection.close()
-        except:
-            LOG('Shared.DC.ZRDB.Connection',
-                ERROR,
-                'Error closing relational database connection.',
-                error=exc_info())
-        self._v_connected=''
+        self.manage_close_connection()
         DB=self.factory()
         try:
             try:




More information about the Zope-Checkins mailing list