add method to remove metaoptions (debug, the new 'meta.pubmsg_needs_bot_prefix') from a list. provided for convenience

This commit is contained in:
Brian S. Stephan 2010-08-01 12:13:38 -05:00
parent d590eede2a
commit e13264fc3b
2 changed files with 11 additions and 6 deletions

View File

@ -226,6 +226,16 @@ class Module(object):
else:
return attempt
def remove_metaoptions(self, list):
"""Remove metaoptions from provided list, which was probably from a config file."""
list.remove('debug')
# if this option has been provided, don't print it
try:
self.config.get(self.__class__.__name__, 'meta.pubmsg_needs_bot_prefix')
cdlist.remove('meta.pubmsg_needs_bot_prefix')
except NoOptionError: pass
def do(self, connection, event, nick, userhost, replypath, what, admin_unlocked):
"""
Do the primary thing this module was intended to do.

View File

@ -49,12 +49,7 @@ class Countdown(Module):
elif whats[1] == 'list':
try:
cdlist = self.config.options(self.__class__.__name__)
cdlist.remove('debug')
# if this option has been provided, don't print it
try:
self.config.get(self.__class__.__name__, 'meta.pubmsg_needs_bot_prefix')
cdlist.remove('meta.pubmsg_needs_bot_prefix')
except NoOptionError: pass
self.remove_metaoptions(cdlist)
cdlist.sort()
liststr = ', '.join(cdlist)
return self.reply(connection, replypath, liststr)