[Zope-DB] Shared.DC.ZRDB.Connection bare try: except?

Christian Theune ct at gocept.com
Sat Sep 20 12:13:16 EDT 2003

Am Sa, 2003-09-20 um 17.03 schrieb Chris Withers:
> Chris Withers wrote:
> Would anyone have any objections to me changing this to:
>      def manage_close_connection(self, REQUEST):
>          " "
>          try: self._v_database_connection.close()
>          except:
>            LOG('Connection.py',
>                 ERROR,
>                 'Error closing database connection',
>                 error=exc_info())
>          self._v_connected=''
>          return self.manage_main(self, REQUEST)


> If I do change it, any reason why I shouldn't change it on the 2.6, 2.7 and HEAD 
> branches?

HEAD and 2.7 in any case. 2.6 ... I would be fine with it. Could be
declared as a bugfix as bare try:excepts: are bad anyway.

> > On this last point, has anyone implemented something like an 
> > 'auto-reconnect' feature for DCOracle 2 so that the user never sees the 
> > DCOracle2 Error: (1012, 'ORA-01012: not logged on') message?
> Hmmm, I'm guessing ZSQL methods call the DA/Connection object to get the 
> database connection? Is there anything that can be done in 
> Shared.DC.ZRDB.Connection.Connection.__call__ to do this re-connection if the 
> connection is found to be disconnected?
> What would be the best way to find out if the connection is disconnected?

Only the python database module can know that for sure. Actually the
ZRDB API doesn't require anything to be Python DB API compliant, so you
can't count on that. Most DAs use _v_connected != None to indicate they
(not the python modules) have a connection.

Shared.DC.ZRDB has no conveniently documented interfaces anyway. :/


Christian Theune, gocept gmbh & co. kg
http://www.gocept.com - ct at gocept.com
fon: 03496 3099112 fax: 03496 3099118 mobile: 0179 7808366
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://lists.zope.org/pipermail/zope-db/attachments/20030920/554ce39f/attachment.bin

More information about the Zope-DB mailing list