--- a/appobject.py Tue Sep 20 15:14:04 2011 +0200
+++ b/appobject.py Wed Sep 21 17:38:00 2011 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
@@ -241,7 +241,7 @@
for selector in selectors:
try:
selector = _instantiate_selector(selector)
- except:
+ except Exception:
pass
#assert isinstance(selector, Selector), selector
if isinstance(selector, cls):
--- a/cwconfig.py Tue Sep 20 15:14:04 2011 +0200
+++ b/cwconfig.py Wed Sep 21 17:38:00 2011 +0200
@@ -618,7 +618,7 @@
try:
__import__('cubes.%s.ccplugin' % cube)
cls.info('loaded cubicweb-ctl plugin from %s', cube)
- except:
+ except Exception:
cls.exception('while loading plugin %s', pluginfile)
elif exists(oldpluginfile):
warn('[3.6] %s: ecplugin module should be renamed to ccplugin' % cube,
@@ -626,12 +626,12 @@
try:
__import__('cubes.%s.ecplugin' % cube)
cls.info('loaded cubicweb-ctl plugin from %s', cube)
- except:
+ except Exception:
cls.exception('while loading plugin %s', oldpluginfile)
elif exists(initfile):
try:
__import__('cubes.%s' % cube)
- except:
+ except Exception:
cls.exception('while loading cube %s', cube)
else:
cls.warning('no __init__ file in cube %s', cube)
--- a/cwctl.py Tue Sep 20 15:14:04 2011 +0200
+++ b/cwctl.py Wed Sep 21 17:38:00 2011 +0200
@@ -554,7 +554,7 @@
pid = int(open(pidf).read().strip())
try:
kill(pid, signal.SIGTERM)
- except:
+ except Exception:
print >> sys.stderr, "process %s seems already dead." % pid
else:
try:
@@ -564,7 +564,7 @@
print >> sys.stderr, 'trying SIGKILL'
try:
kill(pid, signal.SIGKILL)
- except:
+ except Exception:
# probably dead now
pass
wait_process_end(pid)
--- a/dataimport.py Tue Sep 20 15:14:04 2011 +0200
+++ b/dataimport.py Wed Sep 21 17:38:00 2011 +0200
@@ -554,7 +554,7 @@
self.tell("Run import function '%s'..." % func_name)
try:
func(self)
- except:
+ except Exception:
if self.catcherrors:
self.record_error(func_name, 'While calling %s' % func.__name__)
else:
--- a/dbapi.py Tue Sep 20 15:14:04 2011 +0200
+++ b/dbapi.py Wed Sep 21 17:38:00 2011 +0200
@@ -301,7 +301,7 @@
def set_default_language(self, vreg):
try:
self.lang = vreg.property_value('ui.language')
- except: # property may not be registered
+ except Exception: # property may not be registered
self.lang = 'en'
# use req.__ to translate a message without registering it to the catalog
try:
@@ -532,7 +532,7 @@
if self._closed is None and self._close_on_del:
try:
self.close()
- except:
+ except Exception:
pass
# connection initialization methods ########################################
--- a/devtools/__init__.py Tue Sep 20 15:14:04 2011 +0200
+++ b/devtools/__init__.py Wed Sep 21 17:38:00 2011 +0200
@@ -577,7 +577,7 @@
templcursor.close()
cnx.close()
init_repository(self.config, interactive=False)
- except:
+ except BaseException:
if self.dbcnx is not None:
self.dbcnx.rollback()
print >> sys.stderr, 'building', self.dbname, 'failed'
@@ -752,13 +752,13 @@
value = value.rsplit('.', 1)[0]
try:
row[cellindex] = strptime(value, '%Y-%m-%d %H:%M:%S')
- except:
+ except Exception:
row[cellindex] = strptime(value, '%Y-%m-%d')
if vtype == 'Time' and type(value) is unicode:
found_date = True
try:
row[cellindex] = strptime(value, '%H:%M:%S')
- except:
+ except Exception:
# DateTime used as Time?
row[cellindex] = strptime(value, '%Y-%m-%d %H:%M:%S')
if vtype == 'Interval' and type(value) is int:
--- a/devtools/fill.py Tue Sep 20 15:14:04 2011 +0200
+++ b/devtools/fill.py Wed Sep 21 17:38:00 2011 +0200
@@ -352,7 +352,7 @@
if objtype:
rql += ', %s is %s' % (selectvar, objtype)
rset = cursor.execute(rql)
- except:
+ except Exception:
print "could restrict eid_list with given constraints (%r)" % constraints
return []
return set(eid for eid, in rset.rows)
--- a/devtools/stresstester.py Tue Sep 20 15:14:04 2011 +0200
+++ b/devtools/stresstester.py Wed Sep 21 17:38:00 2011 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
@@ -38,7 +38,7 @@
-o / --report-output <filename>
Write profiler report into <filename> rather than on stdout
-Copyright (c) 2003-2010 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
+Copyright (c) 2003-2011 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
http://www.logilab.fr/ -- mailto:contact@logilab.fr
"""
@@ -73,9 +73,7 @@
start = clock()
try:
cursor.execute(query)
- except KeyboardInterrupt:
- raise
- except:
+ except Exception:
TB_LOCK.acquire()
traceback.print_exc()
TB_LOCK.release()
--- a/devtools/testlib.py Tue Sep 20 15:14:04 2011 +0200
+++ b/devtools/testlib.py Wed Sep 21 17:38:00 2011 +0200
@@ -233,7 +233,7 @@
# web resources
try:
config.global_set_option('embed-allowed', re.compile('.*'))
- except: # not in server only configuration
+ except Exception: # not in server only configuration
pass
#XXX this doesn't need to a be classmethod anymore
@@ -812,15 +812,13 @@
"""
try:
output = viewfunc(**kwargs)
- except (SystemExit, KeyboardInterrupt):
- raise
- except:
+ except Exception:
# hijack exception: generative tests stop when the exception
# is not an AssertionError
klass, exc, tcbk = sys.exc_info()
try:
msg = '[%s in %s] %s' % (klass, view.__regid__, exc)
- except:
+ except Exception:
msg = '[%s in %s] undisplayable exception' % (klass, view.__regid__)
raise AssertionError, msg, tcbk
return self._check_html(output, view, template)
@@ -862,9 +860,7 @@
def assertWellFormed(self, validator, content, context=None):
try:
return validator.parse_string(content)
- except (SystemExit, KeyboardInterrupt):
- raise
- except:
+ except Exception:
# hijack exception: generative tests stop when the exception
# is not an AssertionError
klass, exc, tcbk = sys.exc_info()
@@ -876,7 +872,7 @@
try:
str_exc = str(exc)
- except:
+ except Exception:
str_exc = 'undisplayable exception'
msg += str_exc
if content is not None:
@@ -1179,7 +1175,7 @@
reg._selected = {}
try:
orig_select_best = reg.__class__.__orig_select_best
- except:
+ except Exception:
orig_select_best = reg.__class__._select_best
def instr_select_best(self, *args, **kwargs):
selected = orig_select_best(self, *args, **kwargs)
--- a/doc/tools/pyjsrest.py Tue Sep 20 15:14:04 2011 +0200
+++ b/doc/tools/pyjsrest.py Wed Sep 21 17:38:00 2011 +0200
@@ -102,7 +102,7 @@
for fileid in INDEX_IN_ORDER:
try:
index.remove(fileid)
- except:
+ except Exception:
raise Exception(
'Bad file id %s referenced in INDEX_IN_ORDER in %s, '
'fix this please' % (fileid, __file__))
--- a/entities/adapters.py Tue Sep 20 15:14:04 2011 +0200
+++ b/entities/adapters.py Wed Sep 21 17:38:00 2011 +0200
@@ -1,4 +1,4 @@
-# copyright 2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2010-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
@@ -137,7 +137,7 @@
value = entity.printable_value(rschema, format='text/plain')
except TransformError:
continue
- except:
+ except Exception:
self.exception("can't add value of %s to text index for entity %s",
rschema, entity.eid)
continue
--- a/entities/authobjs.py Tue Sep 20 15:14:04 2011 +0200
+++ b/entities/authobjs.py Wed Sep 21 17:38:00 2011 +0200
@@ -98,7 +98,7 @@
prop = self._cw.execute(
'CWProperty X WHERE X pkey %(k)s, X for_user U, U eid %(u)s',
{'k': pkey, 'u': self.eid}).get_entity(0, 0)
- except:
+ except Exception:
kwargs = dict(pkey=unicode(pkey), value=value)
if self.is_in_group('managers'):
kwargs['for_user'] = self
--- a/etwist/server.py Tue Sep 20 15:14:04 2011 +0200
+++ b/etwist/server.py Wed Sep 21 17:38:00 2011 +0200
@@ -308,7 +308,7 @@
# so we deferred that part to the cubicweb thread
request.process_multipart()
return self._render_request(request)
- except:
+ except Exception:
errorstream = StringIO()
traceback.print_exc(file=errorstream)
return HTTPResponse(stream='<pre>%s</pre>' % errorstream.getvalue(),
--- a/ext/rest.py Tue Sep 20 15:14:04 2011 +0200
+++ b/ext/rest.py Wed Sep 21 17:38:00 2011 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
@@ -71,7 +71,7 @@
try:
try:
eid_num, rest = text.split(u':', 1)
- except:
+ except ValueError:
eid_num, rest = text, '#'+text
eid_num = int(eid_num)
if eid_num < 0:
--- a/hooks/notification.py Tue Sep 20 15:14:04 2011 +0200
+++ b/hooks/notification.py Wed Sep 21 17:38:00 2011 +0200
@@ -191,7 +191,7 @@
def _call(self):
try:
title = self.entity.dc_title()
- except:
+ except Exception:
# may raise an error during deletion process, for instance due to
# missing required relation
title = '#%s' % self.entity.eid
--- a/hooks/syncschema.py Tue Sep 20 15:14:04 2011 +0200
+++ b/hooks/syncschema.py Wed Sep 21 17:38:00 2011 +0200
@@ -87,7 +87,7 @@
session.system_sql(str('ALTER TABLE %s ADD %s integer'
% (table, column)), rollback_on_failure=False)
session.info('added column %s to table %s', column, table)
- except:
+ except Exception:
# silent exception here, if this error has not been raised because the
# column already exists, index creation will fail anyway
session.exception('error while adding column %s to table %s',
@@ -221,8 +221,8 @@
cwuser_cls = self.session.vreg['etypes'].etype_class('CWUser')
for session in repo._sessions.values():
session.user.__class__ = cwuser_cls
- except:
- self.critical('error while setting schmea', exc_info=True)
+ except Exception:
+ self.critical('error while setting schema', exc_info=True)
def rollback_event(self):
self.precommit_event()
--- a/hooks/test/unittest_syncschema.py Tue Sep 20 15:14:04 2011 +0200
+++ b/hooks/test/unittest_syncschema.py Wed Sep 21 17:38:00 2011 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
@@ -182,7 +182,7 @@
self.failIf(self.index_exists('State', 'state_of'))
rset = self.execute('Any X, Y WHERE X state_of Y')
self.assertEqual(len(rset), 2) # user states
- except:
+ except Exception:
import traceback
traceback.print_exc()
finally:
--- a/mail.py Tue Sep 20 15:14:04 2011 +0200
+++ b/mail.py Wed Sep 21 17:38:00 2011 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
@@ -67,7 +67,7 @@
values = b64decode(str(values + '='*padding), '.-')
values = dict(v.split('=') for v in values.split('&'))
fromappid, host = qualif.split('.', 1)
- except:
+ except Exception:
return None
if appid != fromappid or host != gethostname():
return None
--- a/migration.py Tue Sep 20 15:14:04 2011 +0200
+++ b/migration.py Wed Sep 21 17:38:00 2011 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
@@ -488,7 +488,7 @@
try:
oper, version = constraint.split()
self.reverse_dependencies[name].add( (oper, version, cube) )
- except:
+ except Exception:
self.warnings.append(
'cube %s depends on %s but constraint badly '
'formatted: %s' % (cube, name, constraint))
--- a/misc/cwdesklets/rqlsensor/__init__.py Tue Sep 20 15:14:04 2011 +0200
+++ b/misc/cwdesklets/rqlsensor/__init__.py Wed Sep 21 17:38:00 2011 +0200
@@ -15,9 +15,6 @@
#
# You should have received a copy of the GNU Lesser General Public License along
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
-"""
-
-"""
import webbrowser
reload(webbrowser)
@@ -89,7 +86,7 @@
cursor = cnx.cursor()
try:
rset = cursor.execute(rql)
- except:
+ except Exception:
del self._v_cnx
raise
self._urls = []
@@ -101,7 +98,7 @@
output.set('resultbg[%s]' % i, 'black')
try:
self._urls.append(base % 'Any X WHERE X eid %s' % line[0])
- except:
+ except Exception:
self._urls.append('')
i += 1
--- a/req.py Tue Sep 20 15:14:04 2011 +0200
+++ b/req.py Wed Sep 21 17:38:00 2011 +0200
@@ -66,7 +66,7 @@
self.vreg = vreg
try:
encoding = vreg.property_value('ui.encoding')
- except: # no vreg or property not registered
+ except Exception: # no vreg or property not registered
encoding = 'utf-8'
self.encoding = encoding
# cache result of execution for (rql expr / eids),
--- a/server/checkintegrity.py Tue Sep 20 15:14:04 2011 +0200
+++ b/server/checkintegrity.py Wed Sep 21 17:38:00 2011 +0200
@@ -47,7 +47,7 @@
sqlcursor.execute('SELECT type, source FROM entities WHERE eid=%s' % eid)
try:
etype, source = sqlcursor.fetchone()
- except:
+ except Exception:
eids[eid] = False
return False
if source and source != 'system':
@@ -58,7 +58,7 @@
{'x': eid}):
eids[eid] = True
return True
- except: # TypeResolverError, Unauthorized...
+ except Exception: # TypeResolverError, Unauthorized...
pass
eids[eid] = False
return False
--- a/server/migractions.py Tue Sep 20 15:14:04 2011 +0200
+++ b/server/migractions.py Wed Sep 21 17:38:00 2011 +0200
@@ -153,7 +153,7 @@
migrscript, funcname, *args, **kwargs)
except ExecutionError, err:
print >> sys.stderr, "-> %s" % err
- except:
+ except BaseException:
self.rollback()
raise
@@ -1366,7 +1366,7 @@
prop = self.rqlexec(
'CWProperty X WHERE X pkey %(k)s, NOT X for_user U',
{'k': pkey}, ask_confirm=False).get_entity(0, 0)
- except:
+ except Exception:
self.cmd_create_entity('CWProperty', pkey=unicode(pkey), value=value)
else:
prop.set_attributes(value=value)
@@ -1484,14 +1484,14 @@
if not ask_confirm or self.confirm('Execute sql: %s ?' % sql):
try:
cu = self.session.system_sql(sql, args)
- except:
+ except Exception:
ex = sys.exc_info()[1]
if self.confirm('Error: %s\nabort?' % ex, pdb=True):
raise
return
try:
return cu.fetchall()
- except:
+ except Exception:
# no result to fetch
return
--- a/server/msplanner.py Tue Sep 20 15:14:04 2011 +0200
+++ b/server/msplanner.py Wed Sep 21 17:38:00 2011 +0200
@@ -1640,7 +1640,7 @@
self._pending_vrefs = []
try:
res = self.visit_default(node, newroot, terms)[0]
- except:
+ except Exception:
# when a relation isn't supported, we should dereference potentially
# introduced variable refs
for vref in self._pending_vrefs:
--- a/server/pool.py Tue Sep 20 15:14:04 2011 +0200
+++ b/server/pool.py Wed Sep 21 17:38:00 2011 +0200
@@ -73,7 +73,7 @@
# catch exceptions, rollback other sources anyway
try:
cnx.rollback()
- except:
+ except Exception:
source.critical('rollback error', exc_info=sys.exc_info())
# error on rollback, the connection is much probably in a really
# bad state. Replace it by a new one.
@@ -86,12 +86,12 @@
for cu in self._cursors.values():
try:
cu.close()
- except:
+ except Exception:
continue
for _, cnx in self.source_cnxs.values():
try:
cnx.close()
- except:
+ except Exception:
continue
# internals ###############################################################
@@ -135,7 +135,7 @@
try:
# properly close existing connection if any
self.source_cnxs[source.uri][1].close()
- except:
+ except Exception:
pass
source.info('trying to reconnect')
self.source_cnxs[source.uri] = (source, source.get_connection())
--- a/server/repository.py Tue Sep 20 15:14:04 2011 +0200
+++ b/server/repository.py Wed Sep 21 17:38:00 2011 +0200
@@ -413,7 +413,7 @@
cnxset = self._cnxsets_pool.get_nowait()
try:
cnxset.close(True)
- except:
+ except Exception:
self.exception('error while closing %s' % cnxset)
continue
if self.pyro_registered:
@@ -791,7 +791,7 @@
return session.commit()
except (ValidationError, Unauthorized):
raise
- except:
+ except Exception:
self.exception('unexpected error')
raise
@@ -802,7 +802,7 @@
session = self._get_session(sessionid)
session.set_tx_data(txid)
session.rollback()
- except:
+ except Exception:
self.exception('unexpected error')
raise
@@ -905,7 +905,7 @@
for sessionid in self._sessions.keys():
try:
self.close(sessionid, checkshuttingdown=False)
- except:
+ except Exception: # XXX BaseException?
self.exception('error while closing session %s' % sessionid)
def clean_sessions(self):
--- a/server/schemaserial.py Tue Sep 20 15:14:04 2011 +0200
+++ b/server/schemaserial.py Wed Sep 21 17:38:00 2011 +0200
@@ -135,7 +135,7 @@
try:
sqlexec('UPDATE deleted_entities SET type=%(n)s WHERE type=%(x)s',
{'x': etype, 'n': netype})
- except:
+ except Exception:
pass
tocleanup = [eid]
tocleanup += (eid for eid, cached in repo._type_source_cache.iteritems()
--- a/server/serverctl.py Tue Sep 20 15:14:04 2011 +0200
+++ b/server/serverctl.py Wed Sep 21 17:38:00 2011 +0200
@@ -248,7 +248,7 @@
cursor.execute, 'DROP USER %s' % user) is not ERROR:
print '-> user %s dropped.' % user
cnx.commit()
- except:
+ except BaseException:
cnx.rollback()
raise
@@ -363,7 +363,7 @@
createdb(helper, source, dbcnx, cursor)
dbcnx.commit()
print '-> database %s created.' % dbname
- except:
+ except BaseException:
dbcnx.rollback()
raise
cnx = system_source_cnx(source, special_privs='CREATE LANGUAGE',
--- a/server/session.py Tue Sep 20 15:14:04 2011 +0200
+++ b/server/session.py Wed Sep 21 17:38:00 2011 +0200
@@ -573,7 +573,7 @@
return self.DEFAULT_SECURITY
try:
return txstore.write_security
- except:
+ except AttributeError:
txstore.write_security = self.DEFAULT_SECURITY
return txstore.write_security
@@ -775,7 +775,7 @@
self._threaddata.ctx_count += 1
try:
cnxset.cnxset_set()
- except:
+ except Exception:
self._threaddata.cnxset = None
self.repo._free_cnxset(cnxset)
raise
@@ -969,7 +969,7 @@
operation.handle_event('precommit_event')
self.pending_operations[:] = processed
self.debug('precommit session %s done', self.id)
- except:
+ except BaseException:
# if error on [pre]commit:
#
# * set .failed = True on the operation causing the failure
@@ -984,7 +984,7 @@
for operation in reversed(processed):
try:
operation.handle_event('revertprecommit_event')
- except:
+ except BaseException:
self.critical('error while reverting precommit',
exc_info=True)
# XXX use slice notation since self.pending_operations is a
@@ -999,7 +999,7 @@
operation.processed = 'postcommit'
try:
operation.handle_event('postcommit_event')
- except:
+ except BaseException:
self.critical('error while postcommit',
exc_info=sys.exc_info())
self.debug('postcommit session %s done', self.id)
@@ -1030,7 +1030,7 @@
try:
operation = self.pending_operations.pop(0)
operation.handle_event('rollback_event')
- except:
+ except BaseException:
self.critical('rollback error', exc_info=sys.exc_info())
continue
cnxset.rollback()
--- a/server/sources/__init__.py Tue Sep 20 15:14:04 2011 +0200
+++ b/server/sources/__init__.py Wed Sep 21 17:38:00 2011 +0200
@@ -177,7 +177,7 @@
# cw < 3.10 bw compat
try:
processed['adapter'] = confdict['adapter']
- except:
+ except KeyError:
pass
# check for unknown options
if confdict and not confdict.keys() == ['adapter']:
--- a/server/sources/extlite.py Tue Sep 20 15:14:04 2011 +0200
+++ b/server/sources/extlite.py Wed Sep 21 17:38:00 2011 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
@@ -296,7 +296,7 @@
try:
session.cnxset.connection(self.uri).rollback()
self.critical('transaction has been rollbacked')
- except:
+ except Exception:
pass
raise
return cursor
--- a/server/sources/ldapuser.py Tue Sep 20 15:14:04 2011 +0200
+++ b/server/sources/ldapuser.py Wed Sep 21 17:38:00 2011 +0200
@@ -273,7 +273,7 @@
if self._conn is None:
try:
self._connect()
- except:
+ except Exception:
self.exception('unable to connect to ldap:')
return ConnectionWrapper(self._conn)
@@ -570,7 +570,7 @@
try:
for i in range(len(value)):
value[i] = unicode(value[i], 'utf8')
- except:
+ except Exception:
pass
if isinstance(value, list) and len(value) == 1:
rec_dict[key] = value = value[0]
--- a/server/sources/pyrorql.py Tue Sep 20 15:14:04 2011 +0200
+++ b/server/sources/pyrorql.py Wed Sep 21 17:38:00 2011 +0200
@@ -226,7 +226,7 @@
self.cross_relations.remove(ertype)
else:
self.dont_cross_relations.remove(ertype)
- except:
+ except Exception:
self.error('while updating mapping consequently to removal of %s',
schemacfg)
@@ -275,7 +275,7 @@
entity = rset.get_entity(0, 0)
entity.complete(entity.e_schema.indexable_attributes())
source.index_entity(session, entity)
- except:
+ except Exception:
self.exception('while updating %s with external id %s of source %s',
etype, extid, self.uri)
continue
@@ -288,7 +288,7 @@
entity = session.entity_from_eid(eid, etype)
repo.delete_info(session, entity, self.uri, extid,
scleanup=self.eid)
- except:
+ except Exception:
self.exception('while updating %s with external id %s of source %s',
etype, extid, self.uri)
continue
@@ -667,7 +667,7 @@
value = const.eval(self.kwargs)
try:
return None, self._const_var[value]
- except:
+ except Exception:
var = self._varmaker.next()
self.need_translation = True
restr = '%s eid %s' % (var, self.visit_constant(const))
--- a/server/test/data/site_cubicweb.py Tue Sep 20 15:14:04 2011 +0200
+++ b/server/test/data/site_cubicweb.py Wed Sep 21 17:38:00 2011 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
@@ -20,14 +20,10 @@
from logilab.database.sqlite import register_sqlite_pyfunc
from rql.utils import register_function
-try:
- class DUMB_SORT(FunctionDescr):
- pass
+class DUMB_SORT(FunctionDescr):
+ pass
- register_function(DUMB_SORT)
- def dumb_sort(something):
- return something
- register_sqlite_pyfunc(dumb_sort)
-except:
- # already registered
- pass
+register_function(DUMB_SORT)
+def dumb_sort(something):
+ return something
+register_sqlite_pyfunc(dumb_sort)
--- a/server/utils.py Tue Sep 20 15:14:04 2011 +0200
+++ b/server/utils.py Wed Sep 21 17:38:00 2011 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
@@ -16,6 +16,7 @@
# You should have received a copy of the GNU Lesser General Public License along
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
"""Some utilities for the CubicWeb server."""
+
__docformat__ = "restructuredtext en"
import sys
@@ -167,7 +168,7 @@
def auto_remove_func(self=self, func=target):
try:
func()
- except:
+ except Exception:
logger = logging.getLogger('cubicweb.repository')
logger.exception('Unhandled exception in RepoThread %s', self._name)
raise
--- a/sobjects/textparsers.py Tue Sep 20 15:14:04 2011 +0200
+++ b/sobjects/textparsers.py Wed Sep 21 17:38:00 2011 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
@@ -83,7 +83,7 @@
trinfo = iworkflowable.fire_transition(tr)
caller.fire_event('state-changed', {'trinfo': trinfo,
'entity': entity})
- except:
+ except Exception:
self.exception('while changing state of %s', entity)
else:
self.error("can't pass transition %s on entity %s",
--- a/uilib.py Tue Sep 20 15:14:04 2011 +0200
+++ b/uilib.py Wed Sep 21 17:38:00 2011 +0200
@@ -406,10 +406,10 @@
def exc_message(ex, encoding):
try:
return unicode(ex)
- except:
+ except Exception:
try:
return unicode(str(ex), encoding, 'replace')
- except:
+ except Exception:
return unicode(repr(ex), encoding, 'replace')
@@ -423,7 +423,7 @@
res.append(u'\n')
try:
res.append(u'\t Error: %s\n' % exception)
- except:
+ except Exception:
pass
return u'\n'.join(res)
--- a/view.py Tue Sep 20 15:14:04 2011 +0200
+++ b/view.py Wed Sep 21 17:38:00 2011 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
@@ -174,7 +174,7 @@
stream = self.set_stream(w)
try:
view_func(**context)
- except:
+ except Exception:
self.debug('view call %s failed (context=%s)', view_func, context)
raise
# return stream content if we have created it
--- a/web/application.py Tue Sep 20 15:14:04 2011 +0200
+++ b/web/application.py Wed Sep 21 17:38:00 2011 +0200
@@ -423,7 +423,7 @@
if req.cnx and not commited:
try:
req.cnx.rollback()
- except:
+ except Exception:
pass # ignore rollback error at this point
self.info('query %s executed in %s sec', req.relative_path(), clock() - tstart)
return result
@@ -460,7 +460,7 @@
errview = self.vreg['views'].select('error', req)
template = self.main_template_id(req)
content = self.vreg['views'].main_template(req, template, view=errview)
- except:
+ except Exception:
content = self.vreg['views'].main_template(req, 'error-template')
raise StatusResponse(code, content)
--- a/web/test/unittest_viewselector.py Tue Sep 20 15:14:04 2011 +0200
+++ b/web/test/unittest_viewselector.py Wed Sep 21 17:38:00 2011 +0200
@@ -76,7 +76,7 @@
return
try:
self.assertSetEqual(content.keys(), expected)
- except:
+ except Exception:
print registry, sorted(expected), sorted(content.keys())
print 'no more', [v for v in expected if not v in content.keys()]
print 'missing', [v for v in content.keys() if not v in expected]
@@ -468,7 +468,7 @@
try:
obj = self.vreg['views'].select(vid, req, rset=rset, **args)
return obj.render(**args)
- except:
+ except Exception:
print vid, rset, args
raise
--- a/web/views/autoform.py Tue Sep 20 15:14:04 2011 +0200
+++ b/web/views/autoform.py Wed Sep 21 17:38:00 2011 +0200
@@ -325,7 +325,7 @@
def _entity(self):
try:
cls = self._cw.vreg['etypes'].etype_class(self.etype)
- except:
+ except Exception:
self.w(self._cw._('no such entity type %s') % self.etype)
return
entity = cls(self._cw)
--- a/web/views/baseviews.py Tue Sep 20 15:14:04 2011 +0200
+++ b/web/views/baseviews.py Wed Sep 21 17:38:00 2011 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
@@ -405,7 +405,7 @@
value = xml_escape(entity.printable_value(attr, format='text/plain').lower())
except TransformError, ex:
continue
- except:
+ except Exception:
continue
if searched in value:
contexts = []
--- a/web/views/forms.py Tue Sep 20 15:14:04 2011 +0200
+++ b/web/views/forms.py Wed Sep 21 17:38:00 2011 +0200
@@ -277,7 +277,7 @@
for editedfield in splitstrip(editedfields):
try:
name, role = editedfield.split('-')
- except:
+ except Exception:
name = editedfield
role = None
if entityform:
--- a/web/views/magicsearch.py Tue Sep 20 15:14:04 2011 +0200
+++ b/web/views/magicsearch.py Wed Sep 21 17:38:00 2011 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
@@ -387,7 +387,7 @@
procname, query = uquery.split(':', 1)
proc = self.by_name[procname.strip().lower()]
uquery = query.strip()
- except:
+ except Exception:
# use processor chain
unauthorized = None
for proc in self.processors:
--- a/web/views/sessions.py Tue Sep 20 15:14:04 2011 +0200
+++ b/web/views/sessions.py Wed Sep 21 17:38:00 2011 +0200
@@ -119,7 +119,7 @@
req.cnx.commit()
except (RepositoryError, Unauthorized):
req.cnx.rollback()
- except:
+ except Exception:
req.cnx.rollback()
raise
@@ -130,10 +130,5 @@
self.info('closing http session %s' % session.sessionid)
del self._sessions[session.sessionid]
if session.cnx:
- try:
- session.cnx.close()
- except:
- # already closed, may occur if the repository session expired
- # but not the web session
- pass
+ session.cnx.close()
session.cnx = None
--- a/wsgi/__init__.py Tue Sep 20 15:14:04 2011 +0200
+++ b/wsgi/__init__.py Wed Sep 21 17:38:00 2011 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
@@ -37,7 +37,7 @@
"""pretty prints `obj` if possible"""
try:
return _pformat(obj)
- except:
+ except Exception:
return u'<could not parse>'
def qs2dict(qs):