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:
Jeremy Fincher 2003-10-30 02:13:12 +00:00
parent 83e16b0d89
commit 47a9d24434
2 changed files with 10 additions and 10 deletions

View File

@ -185,17 +185,17 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
setattr(conf, name, value)
irc.reply(msg, conf.replySuccess)
elif name:
typetable = {'mystr': 'string',
'mybool': 'boolean',
'float': 'float'}
typeNames = {conf.mystr: 'string',
conf.mybool: 'boolean',
float: 'float'}
try:
vtype = conf.types[name].__name__
type = typeNames[conf.types[name]]
except KeyError:
irc.error(msg, 'That conf variable doesn\'t exist.')
irc.error(msg, 'That configuration variable doesn\'t exist.')
return
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:
irc.error(msg, '%s is of an unknown type.' % name)
else:

View File

@ -101,9 +101,9 @@ class OwnerTestCase(PluginTestCase, PluginDocumentation):
def testSetconf(self):
self.assertRegexp('setconf', 'confDir')
self.assertNotRegexp('setconf', 'allowEval')
self.assertResponse('setconf confDir', 'confDir is a string.')
self.assertResponse('setconf whackyConfOption',
'Error: That conf variable doesn\'t exist.')
self.assertResponse('setconf confDir',
'confDir is a string (%s).' % conf.confDir)
self.assertError('setconf whackyConfOption')
try:
originalConfAllowEval = conf.allowEval
conf.allowEval = False