toolsutils.py
branchstable
changeset 8743 27a83746aebd
parent 8697 574bb05e40a4
child 9740 c0239d8ae742
child 9928 0d831b40fa48
--- a/toolsutils.py	Tue Mar 19 16:56:46 2013 +0100
+++ b/toolsutils.py	Wed Mar 20 17:40:25 2013 +0100
@@ -59,7 +59,7 @@
     try:
         makedirs(directory)
         print '-> created directory %s' % directory
-    except OSError, ex:
+    except OSError as ex:
         import errno
         if ex.errno != errno.EEXIST:
             raise
@@ -176,7 +176,7 @@
                 if option[0] == '[':
                     # start a section
                     section = option[1:-1]
-                    assert not config.has_key(section), \
+                    assert section not in config, \
                            'Section %s is defined more than once' % section
                     config[section] = current = {}
                     continue
@@ -185,7 +185,7 @@
             option = option.strip().replace(' ', '_')
             value = value.strip()
             current[option] = value or None
-    except IOError, ex:
+    except IOError as ex:
         if raise_if_unreadable:
             raise ExecutionError('%s. Are you logged with the correct user '
                                  'to use this instance?' % ex)