diff options
author | kongr45gpen <electrovesta@gmail.com> | 2016-09-16 16:32:05 +0300 |
---|---|---|
committer | kongr45gpen <electrovesta@gmail.com> | 2016-09-16 16:32:05 +0300 |
commit | f161a009ceeb3970f5bed2bc569bb0696e2001c8 (patch) | |
tree | 19a641889714c5f96eb6aed500ccb06575bac726 /local/utility.py | |
parent | af9f6faad73a4cc0e75394d4ff99134619164c05 (diff) | |
download | supybot_github-f161a009ceeb3970f5bed2bc569bb0696e2001c8.tar.gz supybot_github-f161a009ceeb3970f5bed2bc569bb0696e2001c8.tar.bz2 supybot_github-f161a009ceeb3970f5bed2bc569bb0696e2001c8.zip |
Allow using supybot to override config values for each channel
Diffstat (limited to 'local/utility.py')
-rw-r--r-- | local/utility.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/local/utility.py b/local/utility.py index b16646f..e84ea28 100644 --- a/local/utility.py +++ b/local/utility.py @@ -5,6 +5,7 @@ import string import urllib2 from datetime import datetime, timedelta +import supybot.log as log import supybot.conf as conf import supybot.world as world import supybot.ircutils as ircutils @@ -18,10 +19,14 @@ def registryValue(plugin, name, channel=None, value=True): for name in names: group = group.get(name) if channel is not None: - if ircutils.isChannel(channel): - group = group.get(channel) - else: - self.log.debug('registryValue got channel=%r', channel) + try: + if ircutils.isChannel(channel): + group = group.get(channel) + else: + log.debug('registryValue got channel=%r', channel) + except registry.NonExistentRegistryEntry: + log.debug('non existent registry entry %r for channel %r', name, channel) + pass if value: return group() else: @@ -30,6 +35,10 @@ def registryValue(plugin, name, channel=None, value=True): def configValue(name, channel=None, repo=None, type=None, module=None): if globals.configOverrides and name.lower() in globals.configOverrides: return globals.configOverrides[name.lower()] + + if channel == None and name not in ['channel', 'passcode', 'disallowChannelOverride', 'disallowConfigOverride']: + channel = globals.channel + return registryValue("Github", name, channel) def addConfigOverride(name, value): |