1
0
mirror of https://github.com/JoelBender/bacpypes synced 2025-10-27 00:57:47 +08:00

rip out the allow_exec from consolecmd with extreme prejudice

This commit is contained in:
Joel Bender
2016-01-28 15:10:35 -05:00
parent f4afe0ce19
commit 7e0b3a627a
3 changed files with 3 additions and 60 deletions

View File

@@ -39,7 +39,7 @@ def console_interrupt(*args):
class ConsoleCmd(cmd.Cmd, Thread, Logging):
def __init__(self, prompt="> ", allow_exec=False, stdin=None, stdout=None):
def __init__(self, prompt="> ", stdin=None, stdout=None):
if _debug: ConsoleCmd._debug("__init__")
cmd.Cmd.__init__(self, stdin=stdin, stdout=stdout)
Thread.__init__(self, name="ConsoleCmd")
@@ -53,9 +53,6 @@ class ConsoleCmd(cmd.Cmd, Thread, Logging):
else:
self.prompt = ''
# save the exec option
self.allow_exec = allow_exec
# gc counters
self.type2count = {}
self.type2all = {}
@@ -63,10 +60,6 @@ class ConsoleCmd(cmd.Cmd, Thread, Logging):
# logging handlers
self.handlers = {}
# execution space for the user
self._locals = {}
self._globals = {}
# set a INT signal handler, ^C will only get sent to the
# main thread and there's no way to break the readline
# call initiated by this thread - sigh
@@ -306,16 +299,4 @@ class ConsoleCmd(cmd.Cmd, Thread, Logging):
"""Do nothing on empty input line"""
pass
def default(self, line):
"""Called on an input line when the command prefix is not recognized.
If allow_exec is enabled, execute the line as Python code.
"""
if not self.allow_exec:
return cmd.Cmd.default(self, line)
try:
exec(line) in self._locals, self._globals
except Exception, err:
self.stdout.write("%s : %s\n" % (err.__class__, err))
bacpypes_debugging(ConsoleCmd)