diff --git a/lib/_range.py b/lib/_range.py index ee9c329e..5db10a3c 100644 --- a/lib/_range.py +++ b/lib/_range.py @@ -491,6 +491,7 @@ class NumberRangeAdapter(RangeAdapter): return ("'%s%s,%s%s'" % ( r._bounds[0], lower, upper, r._bounds[1])).encode('ascii') + # TODO: probably won't work with infs, nans and other tricky cases. register_adapter(NumericRange, NumberRangeAdapter) diff --git a/lib/extras.py b/lib/extras.py index c33cffc2..a2f56389 100644 --- a/lib/extras.py +++ b/lib/extras.py @@ -30,10 +30,7 @@ import sys as _sys import time as _time import re as _re -try: - import logging as _logging -except: - _logging = None +import logging as _logging import psycopg2 from psycopg2 import extensions as _ext @@ -189,7 +186,7 @@ class DictRow(list): def get(self, x, default=None): try: return self[x] - except: + except Exception: return default def iteritems(self): diff --git a/lib/pool.py b/lib/pool.py index a91c9cc0..5cca1603 100644 --- a/lib/pool.py +++ b/lib/pool.py @@ -138,7 +138,7 @@ class AbstractConnectionPool(object): for conn in self._pool + list(self._used.values()): try: conn.close() - except: + except Exception: pass self.closed = True diff --git a/lib/tz.py b/lib/tz.py index 92a16041..bf046310 100644 --- a/lib/tz.py +++ b/lib/tz.py @@ -132,6 +132,7 @@ class LocalTimezone(datetime.tzinfo): tt = time.localtime(stamp) return tt.tm_isdst > 0 + LOCAL = LocalTimezone() # TODO: pre-generate some interesting time zones?