(self, datastructure)
Take the decoded YAML configuration and store it as usable
        datastructures. See ``self.__init__``.

        :raises: ``InvalidConfiguration`` if the configuration is invalid.
Take the decoded YAML configuration and store it as usable
        datastructures. See ``self.__init__``.
Take the decoded YAML configuration and store it as usable datastructures . See self . __init__ .
def _parse_adapters(self, datastructure):
        """
        Take the decoded YAML configuration and store it as usable
        datastructures. See ``self.__init__``.

        :raises: ``InvalidConfiguration`` if the configuration is invalid.
        """
        try:
            self._endpoints = datastructure["endpoints"]
        except KeyError:
            raise InvalidConfiguration("Required key 'endpoints' is missing.")
        except TypeError:
            raise InvalidConfiguration("Could not parse adapters file.")
        try:
            self._adapters = datastructure["adapters"]
        except KeyError:
            raise InvalidConfiguration("Required key 'adapters' is missing.")

        # Sanity check that all referenced adapters exist and that optional pre
        # and post keys are added, with no unknown keys
        known_adapters = self.adapters()
        referenced_adapters = set()
        for endpoint, config in self._endpoints.iteritems():
            config_keys = set(config.keys())
            if not config_keys:
                raise InvalidConfiguration(
                    "No configuration found for endpoint '%s'" % (endpoint,))

            unknown_keys = config_keys - set(["pre", "post"])
            if unknown_keys:
                raise InvalidConfiguration(
                    "Unkonwn keys found in endpoint configuration: %s" %
                        (", ".join(unknown_keys)))

            if "pre" not in config:
                config['pre'] = []
            if "post" not in config:
                config['post'] = []

            referenced_adapters.update(config['pre'])
            referenced_adapters.update(config['post'])

        unkown_adapters = referenced_adapters - known_adapters
        if unkown_adapters:
            raise InvalidConfiguration(
                "Plugins were referenced in endpoint configuration but not "
                "defined: %s" % (", ".join(unkown_adapters)))
def _parse_adapters ( self , datastructure ) : try : self . _endpoints = datastructure [ "endpoints" ] except KeyError : raise InvalidConfiguration ( "Required key 'endpoints' is missing." ) except TypeError : raise InvalidConfiguration ( "Could not parse adapters file." ) try : self . _adapters = datastructure [ "adapters" ] except KeyError : raise InvalidConfiguration ( "Required key 'adapters' is missing." ) # Sanity check that all referenced adapters exist and that optional pre # and post keys are added, with no unknown keys known_adapters = self . adapters ( ) referenced_adapters = set ( ) for endpoint , config in self . _endpoints . iteritems ( ) : config_keys = set ( config . keys ( ) ) if not config_keys : raise InvalidConfiguration ( "No configuration found for endpoint '%s'" % ( endpoint , ) ) unknown_keys = config_keys - set ( [ "pre" , "post" ] ) if unknown_keys : raise InvalidConfiguration ( "Unkonwn keys found in endpoint configuration: %s" % ( ", " . join ( unknown_keys ) ) ) if "pre" not in config : config [ 'pre' ] = [ ] if "post" not in config : config [ 'post' ] = [ ] referenced_adapters . update ( config [ 'pre' ] ) referenced_adapters . update ( config [ 'post' ] ) unkown_adapters = referenced_adapters - known_adapters if unkown_adapters : raise InvalidConfiguration ( "Plugins were referenced in endpoint configuration but not " "defined: %s" % ( ", " . join ( unkown_adapters ) ) )