Commit 795e7e59 authored by Chris Withers's avatar Chris Withers

changed some bare try: except:'s in Shared.DC.ZRDB.Connection

       so that they now log exceptions that occur.
parent c6446fe3
...@@ -18,6 +18,9 @@ Zope Changes ...@@ -18,6 +18,9 @@ Zope Changes
- Collector #1039: Whitespace problem in Z2.log fixed - Collector #1039: Whitespace problem in Z2.log fixed
- changed some bare try: except:'s in Shared.DC.ZRDB.Connection
so that they now log exceptions that occur.
2.7.0b2 2.7.0b2
Features added Features added
......
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
############################################################################## ##############################################################################
__doc__='''Generic Database Connection Support __doc__='''Generic Database Connection Support
$Id: Connection.py,v 1.35 2002/08/14 21:50:59 mj Exp $''' $Id: Connection.py,v 1.36 2003/09/24 14:28:43 chrisw Exp $'''
__version__='$Revision: 1.35 $'[11:-2] __version__='$Revision: 1.36 $'[11:-2]
import Globals, OFS.SimpleItem, AccessControl.Role, Acquisition, sys import Globals, OFS.SimpleItem, AccessControl.Role, Acquisition, sys
from DateTime import DateTime from DateTime import DateTime
...@@ -23,6 +23,8 @@ from string import find, join, split ...@@ -23,6 +23,8 @@ from string import find, join, split
from Aqueduct import custom_default_report from Aqueduct import custom_default_report
from cStringIO import StringIO from cStringIO import StringIO
from Results import Results from Results import Results
from sys import exc_info
from zLOG import LOG, ERROR
import DocumentTemplate, RDB import DocumentTemplate, RDB
class Connection( class Connection(
...@@ -63,7 +65,11 @@ class Connection( ...@@ -63,7 +65,11 @@ class Connection(
Globals.Persistent.__setstate__(self, state) Globals.Persistent.__setstate__(self, state)
if self.connection_string: if self.connection_string:
try: self.connect(self.connection_string) try: self.connect(self.connection_string)
except: pass except:
LOG('Shared.DC.ZRDB.Connection',
ERROR,
'Error connecting to relational database.',
error=exc_info())
def title_and_id(self): def title_and_id(self):
s=Connection.inheritedAttribute('title_and_id')(self) s=Connection.inheritedAttribute('title_and_id')(self)
...@@ -139,7 +145,11 @@ class Connection( ...@@ -139,7 +145,11 @@ class Connection(
def manage_close_connection(self, REQUEST): def manage_close_connection(self, REQUEST):
" " " "
try: self._v_database_connection.close() try: self._v_database_connection.close()
except: pass except:
LOG('Shared.DC.ZRDB.Connection',
ERROR,
'Error closing relational database connection.',
error=exc_info())
self._v_connected='' self._v_connected=''
return self.manage_main(self, REQUEST) return self.manage_main(self, REQUEST)
...@@ -160,7 +170,11 @@ class Connection( ...@@ -160,7 +170,11 @@ class Connection(
def connect(self,s): def connect(self,s):
try: self._v_database_connection.close() try: self._v_database_connection.close()
except: pass except:
LOG('Shared.DC.ZRDB.Connection',
ERROR,
'Error closing relational database connection.',
error=exc_info())
self._v_connected='' self._v_connected=''
DB=self.factory() DB=self.factory()
try: try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment