diff --git a/feedgen/util.py b/feedgen/util.py index e361651..ca4ad58 100644 --- a/feedgen/util.py +++ b/feedgen/util.py @@ -64,11 +64,11 @@ def ensure_format(val, allowed, required, allowed_values=None, defaults=None): return val -def formatRFC2822(d): +def formatRFC2822(date): '''Make sure the locale setting do not interfere with the time format. ''' - l = locale.setlocale(locale.LC_ALL) + old = locale.setlocale(locale.LC_ALL) locale.setlocale(locale.LC_ALL, 'C') - d = d.strftime('%a, %d %b %Y %H:%M:%S %z') - locale.setlocale(locale.LC_ALL, l) - return d + date = date.strftime('%a, %d %b %Y %H:%M:%S %z') + locale.setlocale(locale.LC_ALL, old) + return date diff --git a/tests/test_main.py b/tests/test_main.py index 7985289..efea777 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -27,7 +27,7 @@ class TestSequenceFunctions(unittest.TestCase): sys.argv = ['feedgen', ftype] try: __main__.main() - except: + except Exception: assert False def test_file(self): @@ -36,7 +36,7 @@ class TestSequenceFunctions(unittest.TestCase): sys.argv = ['feedgen', filename] try: __main__.main() - except: + except Exception: assert False os.close(fh) os.remove(filename)