mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 20:52:42 +01:00
Changed setconf to show what the value of the variable is if we don't give something to set it.
This commit is contained in:
parent
83e16b0d89
commit
47a9d24434
14
src/Owner.py
14
src/Owner.py
@ -185,17 +185,17 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
setattr(conf, name, value)
|
setattr(conf, name, value)
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.reply(msg, conf.replySuccess)
|
||||||
elif name:
|
elif name:
|
||||||
typetable = {'mystr': 'string',
|
typeNames = {conf.mystr: 'string',
|
||||||
'mybool': 'boolean',
|
conf.mybool: 'boolean',
|
||||||
'float': 'float'}
|
float: 'float'}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
vtype = conf.types[name].__name__
|
type = typeNames[conf.types[name]]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
irc.error(msg, 'That conf variable doesn\'t exist.')
|
irc.error(msg, 'That configuration variable doesn\'t exist.')
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
irc.reply(msg, '%s is a %s.' % (name, typetable[vtype]))
|
value = getattr(conf, name)
|
||||||
|
irc.reply(msg, '%s is a %s (%s).' % (name, type, value))
|
||||||
except KeyError:
|
except KeyError:
|
||||||
irc.error(msg, '%s is of an unknown type.' % name)
|
irc.error(msg, '%s is of an unknown type.' % name)
|
||||||
else:
|
else:
|
||||||
|
@ -101,9 +101,9 @@ class OwnerTestCase(PluginTestCase, PluginDocumentation):
|
|||||||
def testSetconf(self):
|
def testSetconf(self):
|
||||||
self.assertRegexp('setconf', 'confDir')
|
self.assertRegexp('setconf', 'confDir')
|
||||||
self.assertNotRegexp('setconf', 'allowEval')
|
self.assertNotRegexp('setconf', 'allowEval')
|
||||||
self.assertResponse('setconf confDir', 'confDir is a string.')
|
self.assertResponse('setconf confDir',
|
||||||
self.assertResponse('setconf whackyConfOption',
|
'confDir is a string (%s).' % conf.confDir)
|
||||||
'Error: That conf variable doesn\'t exist.')
|
self.assertError('setconf whackyConfOption')
|
||||||
try:
|
try:
|
||||||
originalConfAllowEval = conf.allowEval
|
originalConfAllowEval = conf.allowEval
|
||||||
conf.allowEval = False
|
conf.allowEval = False
|
||||||
|
Loading…
Reference in New Issue
Block a user