[Zconfig] SVN: ZConfig/trunk/ Massive style cleanup: Move to new raise exception style; for motivation, see:

Martijn Pieters mj at zopatista.com
Wed Aug 31 15:06:25 EDT 2005


Log message for revision 38209:
  Massive style cleanup: Move to new raise exception style; for motivation, see:
      
    http://permalink.gmane.org/gmane.comp.web.zope.zope3/13884
  

Changed:
  U   ZConfig/trunk/components/logger/handlers.py
  U   ZConfig/trunk/datatypes.py

-=-
Modified: ZConfig/trunk/components/logger/handlers.py
===================================================================
--- ZConfig/trunk/components/logger/handlers.py	2005-08-31 18:37:12 UTC (rev 38208)
+++ ZConfig/trunk/components/logger/handlers.py	2005-08-31 19:06:25 UTC (rev 38209)
@@ -43,7 +43,7 @@
         # not expect positional args.
         value % _log_format_variables
     except (ValueError, KeyError):
-        raise ValueError, 'Invalid log format string %s' % value
+        raise ValueError('Invalid log format string %s' % value)
     return value
 
 _control_char_rewrites = {r'\n': '\n', r'\t': '\t', r'\b': '\b',
@@ -133,11 +133,11 @@
     import urlparse
     scheme, netloc, path, param, query, fragment = urlparse.urlparse(value)
     if scheme != 'http':
-        raise ValueError, 'url must be an http url'
+        raise ValueError('url must be an http url')
     if not netloc:
-        raise ValueError, 'url must specify a location'
+        raise ValueError('url must specify a location')
     if not path:
-        raise ValueError, 'url must specify a path'
+        raise ValueError('url must specify a path')
     q = []
     if param:
         q.append(';')

Modified: ZConfig/trunk/datatypes.py
===================================================================
--- ZConfig/trunk/datatypes.py	2005-08-31 18:37:12 UTC (rev 38208)
+++ ZConfig/trunk/datatypes.py	2005-08-31 19:06:25 UTC (rev 38209)
@@ -251,19 +251,19 @@
     nv = os.path.expanduser(v)
     if os.path.isdir(nv):
         return nv
-    raise ValueError, '%s is not an existing directory' % v
+    raise ValueError('%s is not an existing directory' % v)
 
 def existing_path(v):
     nv = os.path.expanduser(v)
     if os.path.exists(nv):
         return nv
-    raise ValueError, '%s is not an existing path' % v
+    raise ValueError('%s is not an existing path' % v)
 
 def existing_file(v):
     nv = os.path.expanduser(v)
     if os.path.exists(nv):
         return nv
-    raise ValueError, '%s is not an existing file' % v
+    raise ValueError('%s is not an existing file' % v)
 
 def existing_dirpath(v):
     nv = os.path.expanduser(v)
@@ -273,8 +273,8 @@
         return nv
     if os.path.isdir(dir):
         return nv
-    raise ValueError, ('The directory named as part of the path %s '
-                       'does not exist.' % v)
+    raise ValueError('The directory named as part of the path %s '
+                     'does not exist.' % v)
 
 
 class SuffixMultiplier:



More information about the ZConfig mailing list