comparison roundup/cgi/PageTemplates/TALES.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 0942fe89e82e
comparison
equal deleted inserted replaced
5377:12fe83f90f0d 5378:35ea9b1efc14
110 if Iterator is not None: 110 if Iterator is not None:
111 self.Iterator = Iterator 111 self.Iterator = Iterator
112 112
113 def registerType(self, name, handler): 113 def registerType(self, name, handler):
114 if not _valid_name(name): 114 if not _valid_name(name):
115 raise RegistrationError, 'Invalid Expression type "%s".' % name 115 raise RegistrationError('Invalid Expression type "%s".' % name)
116 types = self.types 116 types = self.types
117 if types.has_key(name): 117 if types.has_key(name):
118 raise RegistrationError, ( 118 raise RegistrationError(
119 'Multiple registrations for Expression type "%s".' % 119 'Multiple registrations for Expression type "%s".' %
120 name) 120 name)
121 types[name] = handler 121 types[name] = handler
122 122
123 def getTypes(self): 123 def getTypes(self):
132 type = "standard" 132 type = "standard"
133 expr = expression 133 expr = expression
134 try: 134 try:
135 handler = self.types[type] 135 handler = self.types[type]
136 except KeyError: 136 except KeyError:
137 raise CompilerError, ( 137 raise CompilerError(
138 'Unrecognized expression type "%s".' % type) 138 'Unrecognized expression type "%s".' % type)
139 return handler(type, expr, self) 139 return handler(type, expr, self)
140 140
141 def getContext(self, contexts=None, **kwcontexts): 141 def getContext(self, contexts=None, **kwcontexts):
142 if contexts is not None: 142 if contexts is not None:

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