From cb2ddfbcbf9e7afd211491a553191fe5508f9cb9 Mon Sep 17 00:00:00 2001 From: Keegi Date: Wed, 1 Jun 2011 20:49:12 +0300 Subject: [PATCH] Prevent overwriting built-in commands with aliases, as it would delete access to the built-in command permanently --- pronsole.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pronsole.py b/pronsole.py index 75611c8..cae06e0 100644 --- a/pronsole.py +++ b/pronsole.py @@ -99,6 +99,9 @@ class pronsole(cmd.Cmd): print "Alias '"+alias_name+"' is not defined" return # (re)define an alias + if alias_name not in self.aliases.keys() and hasattr(self.__class__,"do_"+alias_name): + print "Name '"+alias_name+"' is already being used by built-in command" + return func = lambda self,args,alias_def=alias_def: self.onecmd(" ".join((alias_def,args))) self.aliases[alias_name] = alias_def setattr(self.__class__,"do_"+alias_name,func)