mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-03-03 13:00:41 +01:00
Changed not even to define eval/exec when conf.allowEval is False.
This commit is contained in:
parent
b63d48f526
commit
9aede17efd
58
src/Owner.py
58
src/Owner.py
@ -110,7 +110,8 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
_srcPlugins = ('Owner', 'Misc', 'Admin', 'User', 'Channel')
|
_srcPlugins = ('Owner', 'Misc', 'Admin', 'User', 'Channel')
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
callbacks.Privmsg.__init__(self)
|
callbacks.Privmsg.__init__(self)
|
||||||
setattr(self.__class__, 'exec', self.__class__._exec)
|
if hasattr(self.__class__, '_exec'):
|
||||||
|
setattr(self.__class__, 'exec', self.__class__._exec)
|
||||||
self.defaultPlugins = {'list': 'Misc',
|
self.defaultPlugins = {'list': 'Misc',
|
||||||
'capabilities': 'User',
|
'capabilities': 'User',
|
||||||
'addcapability': 'Admin',
|
'addcapability': 'Admin',
|
||||||
@ -242,36 +243,37 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
return
|
return
|
||||||
irc.replySuccess()
|
irc.replySuccess()
|
||||||
|
|
||||||
def eval(self, irc, msg, args):
|
if conf.allowEval:
|
||||||
"""<expression>
|
def eval(self, irc, msg, args):
|
||||||
|
"""<expression>
|
||||||
|
|
||||||
Evaluates <expression> and returns its value.
|
Evaluates <expression> and returns its value.
|
||||||
"""
|
"""
|
||||||
if conf.allowEval:
|
if conf.allowEval:
|
||||||
s = privmsgs.getArgs(args)
|
s = privmsgs.getArgs(args)
|
||||||
try:
|
try:
|
||||||
irc.reply(repr(eval(s)))
|
irc.reply(repr(eval(s)))
|
||||||
except SyntaxError, e:
|
except SyntaxError, e:
|
||||||
irc.reply('%s: %r' % (utils.exnToString(e), s))
|
irc.reply('%s: %r' % (utils.exnToString(e), s))
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
irc.reply(utils.exnToString(e))
|
irc.reply(utils.exnToString(e))
|
||||||
else:
|
else:
|
||||||
irc.error('You must enable conf.allowEval for that to work.')
|
irc.error('You must enable conf.allowEval for that to work.')
|
||||||
|
|
||||||
def _exec(self, irc, msg, args):
|
def _exec(self, irc, msg, args):
|
||||||
"""<statement>
|
"""<statement>
|
||||||
|
|
||||||
Execs <code>. Returns success if it didn't raise any exceptions.
|
Execs <code>. Returns success if it didn't raise any exceptions.
|
||||||
"""
|
"""
|
||||||
if conf.allowEval:
|
if conf.allowEval:
|
||||||
s = privmsgs.getArgs(args)
|
s = privmsgs.getArgs(args)
|
||||||
try:
|
try:
|
||||||
exec s
|
exec s
|
||||||
irc.replySuccess()
|
irc.replySuccess()
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
irc.reply(utils.exnToString(e))
|
irc.reply(utils.exnToString(e))
|
||||||
else:
|
else:
|
||||||
irc.error('You must enable conf.allowEval for that to work.')
|
irc.error('You must enable conf.allowEval for that to work.')
|
||||||
|
|
||||||
def ircquote(self, irc, msg, args):
|
def ircquote(self, irc, msg, args):
|
||||||
"""<string to be sent to the server>
|
"""<string to be sent to the server>
|
||||||
|
@ -53,6 +53,7 @@ registry.open(registryFilename)
|
|||||||
|
|
||||||
import log
|
import log
|
||||||
import conf
|
import conf
|
||||||
|
conf.allowEval = True
|
||||||
|
|
||||||
import fix
|
import fix
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user