def load_from_file()

in clay/config.py [0:0]


    def load_from_file(self, filename):
        '''
        Attempt to load configuration from the given filename. Returns an empty
        dict upon failure.
        '''
        log = self.get_logger('clay.config')

        try:
            filetype = os.path.splitext(filename)[-1].lstrip('.').lower()
            if not filetype in SERIALIZERS:
                log.warning('Unknown config format %s, parsing as JSON' % filetype)
                filetype = 'json'

            # Try getting a safe_load function. If absent, use 'load'.
            load = getattr(SERIALIZERS[filetype], "safe_load",
                           getattr(SERIALIZERS[filetype], "load"))

            config = load(file(filename, 'r'))
            if not config:
                raise ValueError('Empty config')
            log.info('Loaded configuration from %s' % filename)
            return config
        except ValueError as e:
            log.critical('Error loading config from %s: %s' %
                (filename, str(e)))
            sys.exit(1)
            return {}