[pybot-commits] CVS: pybot/pybot/modules eval.py,1.6,1.7
Brought to you by:
niemeyer
|
From: Gustavo N. <nie...@us...> - 2003-08-29 01:01:13
|
Update of /cvsroot/pybot/pybot/pybot/modules
In directory sc8-pr-cvs1:/tmp/cvs-serv395/pybot/modules
Modified Files:
eval.py
Log Message:
Implemented "show eval keywords" command.
Index: eval.py
===================================================================
RCS file: /cvsroot/pybot/pybot/pybot/modules/eval.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** eval.py 29 Aug 2003 00:38:56 -0000 1.6
--- eval.py 29 Aug 2003 01:00:55 -0000 1.7
***************
*** 26,38 ****
HELP = """
The "eval <expr>" command allows you to evaluate expressions
! using the python evaluation mechanism. The following functions are
! currently available: map, zip, len, min, max, chr, ord, abs, hex, int,
! oct, list, long, float, round, tuple, reduce, filter, coerce, plus all
! methods in the 'math' method. For more information on these functions,
! consult the Python manual.
""","""
! This command depends on the "eval" permission. Notice that a malicious
! user is able to hang me using this command, so no untrusted users should
! have this permission.
"""
--- 26,36 ----
HELP = """
The "eval <expr>" command allows you to evaluate expressions
! using the python evaluation mechanism. Use the command "show
! eval keywords" to check which 'keywords' are available in
! the evaluation context.
""","""
! This command depends on the "eval" permission. Notice that a
! malicious user is able to hang me using this command, so no
! untrusted users should have this permission.
"""
***************
*** 89,95 ****
self.dict["zip"] = zip
! # Match 'eval <expr>'
self.re1 = regexp(r"eval (?P<expr>.*?)")
# eval[uate|uation]
mm.register_help("eval(?:uate|uation)?", HELP, "eval")
--- 87,96 ----
self.dict["zip"] = zip
! # eval <expr>
self.re1 = regexp(r"eval (?P<expr>.*?)")
+ # show eval keywords
+ self.re2 = regexp(r"show eval keywords?")
+
# eval[uate|uation]
mm.register_help("eval(?:uate|uation)?", HELP, "eval")
***************
*** 173,178 ****
thread.start_new_thread(self.eval, (msg, m.group("expr")))
else:
! msg.answer("%:", ["Sorry...", "Oops!"],
! "You don't have this power", [".", "!"])
return 0
--- 174,197 ----
thread.start_new_thread(self.eval, (msg, m.group("expr")))
else:
! msg.answer("%:", ["Nope", "Oops"], [".", "!"],
! ["You don't have this power",
! "You can't do this",
! "You're not allowed to do this"],
! [".", "!"])
! return 0
!
! m = self.re2.match(msg.line)
! if m:
! if mm.hasperm(msg, "eval"):
! keywords = self.dict.keys()
! keywords.sort()
! msg.answer("%:", "The following keywords are available:",
! ", ".join(keywords))
! else:
! msg.answer("%:", ["Nope", "Oops"], [".", "!"],
! ["You don't have this power",
! "You can't do this",
! "You're not allowed to do this"],
! [".", "!"])
return 0
|