Replace old except syntax with new one

Drops Python 2.5 support
This commit is contained in:
Stefan Wehrmeyer 2013-12-18 03:22:49 +01:00
parent ad72ca5c4c
commit b3520665d7
2 changed files with 4 additions and 4 deletions

View File

@ -91,7 +91,7 @@ def freeze_export(export, result=None):
serializer_cls = get_serializer(export) serializer_cls = get_serializer(export)
serializer = serializer_cls(export, query) serializer = serializer_cls(export, query)
serializer.serialize() serializer.serialize()
except ProgrammingError, pe: except ProgrammingError as pe:
raise FreezeException("Invalid query: %s" % pe) raise FreezeException("Invalid query: %s" % pe)
@ -110,7 +110,7 @@ def main():
continue continue
log.info("Running: %s", export.name) log.info("Running: %s", export.name)
freeze_export(export) freeze_export(export)
except FreezeException, fe: except FreezeException as fe:
log.error(fe) log.error(fe)
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -31,10 +31,10 @@ class Configuration(object):
fh = open(file_name, 'rb') fh = open(file_name, 'rb')
try: try:
self.data = loader.load(fh) self.data = loader.load(fh)
except ValueError, ve: except ValueError as ve:
raise FreezeException("Invalid freeze file: %s" % ve) raise FreezeException("Invalid freeze file: %s" % ve)
fh.close() fh.close()
except IOError, ioe: except IOError as ioe:
raise FreezeException(unicode(ioe)) raise FreezeException(unicode(ioe))
@property @property