##// END OF EJS Templates
ui: refactor extractchoices so it doesn't break on Python 3...
Augie Fackler -
r33680:d880a6bc default
parent child Browse files
Show More
@@ -1269,9 +1269,10 b' class ui(object):'
1269 1269 m = re.match(br'(?s)(.+?)\$\$([^\$]*&[^ \$].*)', prompt)
1270 1270 msg = m.group(1)
1271 1271 choices = [p.strip(' ') for p in m.group(2).split('$$')]
1272 return (msg,
1273 [(s[s.index('&') + 1].lower(), s.replace('&', '', 1))
1274 for s in choices])
1272 def choicetuple(s):
1273 ampidx = s.index('&')
1274 return s[ampidx + 1:ampidx + 2].lower(), s.replace('&', '', 1)
1275 return (msg, [choicetuple(s) for s in choices])
1275 1276
1276 1277 def promptchoice(self, prompt, default=0):
1277 1278 """Prompt user with a message, read response, and ensure it matches
General Comments 0
You need to be logged in to leave comments. Login now