diff options
| author | makefu <github@syntax-fehler.de> | 2015-08-28 13:53:25 +0200 | 
|---|---|---|
| committer | makefu <github@syntax-fehler.de> | 2015-08-28 13:53:25 +0200 | 
| commit | 60367f4b7bf02b8c2ec074c5ccba6772d175caa9 (patch) | |
| tree | 7f3f05e054259801424be534983274f1d839ac1b /Reaktor | |
| parent | a12e24ae318b5a12f91e81273de9ac1b08bde110 (diff) | |
Reaktor: cleanup
Diffstat (limited to 'Reaktor')
| -rw-r--r-- | Reaktor/reaktor/getconf.py | 15 | ||||
| -rw-r--r-- | Reaktor/reaktor/ircasy.py | 6 | 
2 files changed, 8 insertions, 13 deletions
| diff --git a/Reaktor/reaktor/getconf.py b/Reaktor/reaktor/getconf.py index 168c908c..e513e318 100644 --- a/Reaktor/reaktor/getconf.py +++ b/Reaktor/reaktor/getconf.py @@ -1,14 +1,12 @@ -#getconf = make_getconf("dateiname.json")  -#getconf(key) -> value                     -#oder error                                +#getconf = make_getconf("dateiname.json") +#getconf(key) -> value +#oder error  import imp  import os  def make_getconf(filename): - -      def getconf(prop, default_value=None):          prop_split = prop.split('.')          string = '' @@ -29,5 +27,8 @@ def load_config(filename):      dirname = os.path.dirname(filename)      modname, ext = os.path.splitext(os.path.basename(filename))      file, pathname, description = imp.find_module(modname, [ dirname ]) -    return imp.load_module(modname, file, pathname, description) - +    try: +        ret = imp.load_module(modname, file, pathname, description) +    finally: +        if file: file.close() +    return ret diff --git a/Reaktor/reaktor/ircasy.py b/Reaktor/reaktor/ircasy.py index 38f202fc..bb9028a5 100644 --- a/Reaktor/reaktor/ircasy.py +++ b/Reaktor/reaktor/ircasy.py @@ -22,12 +22,6 @@ class asybot(asychat):      asychat.__init__(self)      #logger magic      self.log = logging.getLogger('asybot_' + nickname) -    #hdlr = logging.handlers.SysLogHandler(facility=logging.handlers.SysLogHandler.LOG_DAEMON) -    #formatter = logging.Formatter( '%(filename)s: %(levelname)s: %(message)s') -    #hdlr.setFormatter(formatter) -    #self.log.addHandler(hdlr) -    logging.basicConfig(level = loglevel) -      self.nickname = nickname      if realname: | 
