diff roundup/cgi/PageTemplates/Expressions.py @ 5378:35ea9b1efc14

Python 3 preparation: "raise" syntax. Changing "raise Exception, value" to "raise Exception(value)". Tool-assisted patch. Particular cases to check carefully are the one place in frontends/ZRoundup/ZRoundup.py where a string exception needed to be fixed, and the one in roundup/cgi/client.py involving raising an exception with a traceback (requires three-argument form of raise in Python 2, which as I understand it requires exec() to avoid a Python 3 syntax error).
author Joseph Myers <jsm@polyomino.org.uk>
date Tue, 24 Jul 2018 21:39:58 +0000
parents 12fe83f90f0d
children d26921b851c3
line wrap: on
line diff
--- a/roundup/cgi/PageTemplates/Expressions.py	Tue Jul 24 21:36:02 2018 +0000
+++ b/roundup/cgi/PageTemplates/Expressions.py	Tue Jul 24 21:39:58 2018 +0000
@@ -57,7 +57,7 @@
 def acquisition_security_filter(orig, inst, name, v, real_validate):
     if real_validate(orig, inst, name, v):
         return 1
-    raise Unauthorized, name
+    raise Unauthorized(name)
 
 def call_with_ns(f, ns, arg=1):
     if arg==2:
@@ -102,7 +102,7 @@
         self._path = path = path.strip().split('/')
         self._base = base = path.pop(0)
         if base and not _valid_name(base):
-            raise CompilerError, 'Invalid variable name "%s"' % base
+            raise CompilerError('Invalid variable name "%s"' % base)
         # Parse path
         self._dp = dp = []
         for i in range(len(path)):
@@ -220,7 +220,7 @@
                     exp = exp[m.end():]
                     m = _interp.search(exp)
                 if '$' in exp:
-                    raise CompilerError, (
+                    raise CompilerError(
                         '$ must be doubled or followed by a simple path')
                 parts.append(exp)
             expr = ''.join(parts)
@@ -308,7 +308,7 @@
             o = object[name]
             # Check access to the item.
             if not validate(object, object, name, o):
-                raise Unauthorized, name
+                raise Unauthorized(name)
             object = o
             continue
 

Roundup Issue Tracker: http://roundup-tracker.org/