diff options
| author | tv <tv@nomic.retiolum> | 2014-04-25 12:52:05 +0200 | 
|---|---|---|
| committer | tv <tv@nomic.retiolum> | 2014-04-25 12:52:05 +0200 | 
| commit | e957c40e5ad65c3088454ef0463d7ae42452196b (patch) | |
| tree | dd09441cd971c854ba4e3a4f35458394ade46be3 /IRC | |
| parent | d7bdbaaa1659289be2b07a532f98058ecba32916 (diff) | |
reaktor getconf: allow default_value
Diffstat (limited to 'IRC')
| -rw-r--r-- | IRC/getconf.py | 7 | ||||
| -rw-r--r-- | IRC/ircasy.py | 5 | ||||
| -rwxr-xr-x | IRC/reaktor.py | 2 | 
3 files changed, 7 insertions, 7 deletions
| diff --git a/IRC/getconf.py b/IRC/getconf.py index f9cd440..168c908 100644 --- a/IRC/getconf.py +++ b/IRC/getconf.py @@ -9,14 +9,17 @@ import os  def make_getconf(filename): -    def getconf(prop): +    def getconf(prop, default_value=None):          prop_split = prop.split('.')          string = ''          config = load_config(filename)          #imp.reload(config)          tmp = config.__dict__          for pr in prop_split: -            tmp = tmp[pr] +            if pr in tmp: +                tmp = tmp[pr] +            else: +                return default_value          return tmp      return getconf diff --git a/IRC/ircasy.py b/IRC/ircasy.py index 259ea98..9a7f44f 100644 --- a/IRC/ircasy.py +++ b/IRC/ircasy.py @@ -114,10 +114,7 @@ class asybot(asychat):        self.on_kick(prefix, command, params, rest)      elif command == 'JOIN': -      try: -        self.on_join(prefix, command, params, rest) -      except:  -        pass +      self.on_join(prefix, command, params, rest)      elif command == '433':        # ERR_NICKNAMEINUSE, retry with another name diff --git a/IRC/reaktor.py b/IRC/reaktor.py index b53ef65..54091c5 100755 --- a/IRC/reaktor.py +++ b/IRC/reaktor.py @@ -36,7 +36,7 @@ class Reaktor(asybot):      return False    def on_join(self, prefix, command, params, rest): -    for command in getconf('on_join'): +    for command in getconf('on_join', []):        self.execute_command(command, None, prefix, params)    def on_privmsg(self, prefix, command, params, rest): | 
