[toward-py3k] rewrite to "except AnException as exc:" (part of #2711624)
The older form is not necessary since we dropped python 2.5 compability. This
will help Python 3.3 experimentation.
# copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr## This file is part of CubicWeb.## CubicWeb is free software: you can redistribute it and/or modify it under the# terms of the GNU Lesser General Public License as published by the Free# Software Foundation, either version 2.1 of the License, or (at your option)# any later version.## CubicWeb is distributed in the hope that it will be useful, but WITHOUT# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more# details.## You should have received a copy of the GNU Lesser General Public License along# with CubicWeb. If not, see <http://www.gnu.org/licenses/>."""Source to query another RQL repository using pyro"""__docformat__="restructuredtext en"_=unicodeimportthreadingfromPyro.errorsimportPyroError,ConnectionClosedErrorfromcubicwebimportConnectionErrorfromcubicweb.server.sourcesimportConnectionWrapperfromcubicweb.server.sources.remoterqlimportRemoteSourceclassPyroRQLSource(RemoteSource):"""External repository source, using Pyro connection"""defget_connection(self):try:returnself._get_connection()except(ConnectionError,PyroError)asex:self.critical("can't get connection to source %s: %s",self.uri,ex)returnConnectionWrapper()defcheck_connection(self,cnx):"""check connection validity, return None if the connection is still valid else a new connection """# we have to transfer manually thread ownership. This can be done safely# since the connections set holding the connection is affected to one# session/thread and can't be called simultaneouslytry:cnx._repo._transferThread(threading.currentThread())exceptAttributeError:# inmemory connectionpasstry:returnsuper(PyroRQLSource,self).check_connection(cnx)exceptConnectionClosedError:# try to reconnectreturnself.get_connection()