comparison roundup/cgi/TAL/TALInterpreter.py @ 5381:0942fe89e82e

Python 3 preparation: change "x.has_key(y)" to "y in x". (Also likewise "not in" where appropriate.) Tool-generated patch.
author Joseph Myers <jsm@polyomino.org.uk>
date Tue, 24 Jul 2018 22:08:17 +0000
parents 35ea9b1efc14
children d26921b851c3
comparison
equal deleted inserted replaced
5380:64c4e43fbb84 5381:0942fe89e82e
65 # Find all the spots we want to substitute. 65 # Find all the spots we want to substitute.
66 to_replace = _interp_regex.findall(text) 66 to_replace = _interp_regex.findall(text)
67 # Now substitute with the variables in mapping. 67 # Now substitute with the variables in mapping.
68 for string in to_replace: 68 for string in to_replace:
69 var = _get_var_regex.findall(string)[0] 69 var = _get_var_regex.findall(string)[0]
70 if mapping.has_key(var): 70 if var in mapping:
71 # Call ustr because we may have an integer for instance. 71 # Call ustr because we may have an integer for instance.
72 subst = ustr(mapping[var]) 72 subst = ustr(mapping[var])
73 try: 73 try:
74 text = text.replace(string, subst) 74 text = text.replace(string, subst)
75 except UnicodeError: 75 except UnicodeError:

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