Commit 2cfca605 authored by Keegi's avatar Keegi

fail more cleanly on non-ascii macro name

parent e73e11d5
......@@ -485,14 +485,14 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
if macro == "": return self.new_macro()
if self.macros.has_key(macro):
old_def = self.macros[macro]
elif hasattr(self.__class__,"do_"+macro):
print _("Name '%s' is being used by built-in command") % macro
return
elif len([c for c in macro if not c.isalnum() and c != "_"]):
print _("Macro name may contain only alphanumeric symbols and underscores")
elif len([c for c in macro.encode("ascii","replace") if not c.isalnum() and c != "_"]):
print _("Macro name may contain only ASCII alphanumeric symbols and underscores")
if webavail:
self.webInterface.AddLog("Macro name may contain only alphanumeric symbols and underscores")
return
elif hasattr(self.__class__,"do_"+macro):
print _("Name '%s' is being used by built-in command") % macro
return
else:
old_def = ""
self.start_macro(macro,old_def)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment