diff test/memorydb.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 c0cda00af479
children 0942fe89e82e
line wrap: on
line diff
--- a/test/memorydb.py	Tue Jul 24 21:36:02 2018 +0000
+++ b/test/memorydb.py	Tue Jul 24 21:39:58 2018 +0000
@@ -267,12 +267,12 @@
         """A convenient way of calling self.getclass(classname)."""
         if self.classes.has_key(classname):
             return self.classes[classname]
-        raise AttributeError, classname
+        raise AttributeError(classname)
 
     def addclass(self, cl):
         cn = cl.classname
         if self.classes.has_key(cn):
-            raise ValueError, cn
+            raise ValueError(cn)
         self.classes[cn] = cl
         if cn not in self.items:
             self.items[cn] = cldb()
@@ -300,7 +300,7 @@
         try:
             return self.classes[classname]
         except KeyError:
-            raise KeyError, 'There is no class called "%s"'%classname
+            raise KeyError('There is no class called "%s"'%classname)
 
     #
     # Class DBs
@@ -363,7 +363,7 @@
             res += self.journals.get(classname, {})[nodeid]
         except KeyError:
             if res: return res
-            raise IndexError, nodeid
+            raise IndexError(nodeid)
         return res
 
     def pack(self, pack_before):

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