#! /usr/bin/env python

import os
import warnings
import yaml


class Config(object):
    config_fname = "configuration.yaml"

    def __init__(self, config_fname=None):
        config_fname = config_fname or self.config_fname
        fo = open(config_fname, "r")
        blob = fo.read()
        fo.close()
        self.config = yaml.load(blob)

    def __getattr__(self, attrname):
        if attrname == "slack_name":
            warnings.warn("The `slack_name` key in %s is deprecated in favor of the `SLACK_NAME` environment variable" %
                          self.config_fname, DeprecationWarning)

        if os.getenv(attrname.upper()) is not None:
            return os.getenv(attrname.upper()).split(',') if ',' in os.getenv(attrname.upper()) else os.getenv(attrname.upper())

        try:
            return self.config[attrname]
        except:
            return ''

    def get(self, attrname, fallback=None):
        return self.config.get(attrname, fallback)


# This deliberately isn't a `getenv` default so `.slack_name` isn't tried if there's a SLACK_NAME
SLACK_NAME = os.getenv("SLACK_NAME")
if SLACK_NAME is None:
    SLACK_NAME = Config().slack_name

@@ -787,25 +787,8 @@
 ))%0A%0A
-        try:%0A    
     
@@ -813,17 +813,21 @@
 nfig
-%5B
+.get(
 attrname
 %5D%0A  
@@ -826,47 +826,13 @@
 name
-%5D%0A        except:%0A            return
+,
  ''
+)
 %0A%0A  

Use attribute get with default in the config instead of a try/catch