From 2cfca605c264fb0df413648489356b68572dcb9f Mon Sep 17 00:00:00 2001 From: Keegi Date: Mon, 23 Jul 2012 15:48:18 +0300 Subject: [PATCH] fail more cleanly on non-ascii macro name --- pronterface.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pronterface.py b/pronterface.py index 2ef102b..3461e99 100755 --- a/pronterface.py +++ b/pronterface.py @@ -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)