コード例 #1
0
ファイル: server.py プロジェクト: ricardodani/holmes-api
    def after_start(self, io_loop):
        if self.db is not None:
            self.application.db = self.db
        else:
            self.application.db = self.application.get_sqlalchemy_session()

        if self.debug:
            from sqltap import sqltap
            self.sqltap = sqltap.start()

        self.application.facters = self._load_facters()
        self.application.validators = self._load_validators()
        self.application.error_handlers = [handler(self.application.config) for handler in self._load_error_handlers()]

        self.application.fact_definitions = {}
        self.application.violation_definitions = {}

        for facter in self.application.facters:
            self.application.fact_definitions.update(facter.get_fact_definitions())

        self._insert_keys(self.application.fact_definitions)

        for validator in self.application.validators:
            self.application.violation_definitions.update(validator.get_violation_definitions())

        self._insert_keys(self.application.violation_definitions)

        self.application.event_bus = NoOpEventBus(self.application)
        self.application.http_client = AsyncHTTPClient(io_loop=io_loop)
        self.connect_pub_sub(io_loop)

        self.application.cache = Cache(self.application)

        self.configure_material_girl()
コード例 #2
0
ファイル: server.py プロジェクト: scorphus/politicos
    def after_start(self, io_loop):
        if self.db is not None:
            self.application.db = self.db
        else:
            self.application.db = self.application.get_sqlalchemy_session()

        if self.debug:
            from sqltap import sqltap
            self.sqltap = sqltap.start()

        self.application.error_handlers = []
        for handler in self._load_error_handlers():
            self.application.error_handlers.append(
                handler(self.application.config)
            )
        self.application.http_client = AsyncHTTPClient(io_loop=io_loop)
コード例 #3
0
ファイル: server.py プロジェクト: marcelometal/holmes-api
    def after_start(self, io_loop):
        if self.db is not None:
            self.application.db = self.db
        else:
            self.application.db = self.application.get_sqlalchemy_session()

        if self.debug:
            from sqltap import sqltap
            self.sqltap = sqltap.start()

        authnz_wrapper_class = self._load_authnz_wrapper()
        if authnz_wrapper_class:
            self.application.authnz_wrapper = authnz_wrapper_class(self.application.config)
        else:
            self.application.authnz_wrapper = None

        self.application.facters = self._load_facters()
        self.application.validators = self._load_validators()
        self.application.error_handlers = [handler(self.application.config) for handler in self._load_error_handlers()]

        self.application.search_provider = self._load_search_provider()(
            config=self.application.config,
            db=self.application.db,
            authnz_wrapper=self.application.authnz_wrapper,
            io_loop=io_loop
        )

        self.application.fact_definitions = {}
        self.application.violation_definitions = {}

        self.application.default_violations_values = {}

        for facter in self.application.facters:
            self.application.fact_definitions.update(facter.get_fact_definitions())

        Key.insert_keys(self.application.db, self.application.fact_definitions)

        for validator in self.application.validators:
            self.application.violation_definitions.update(validator.get_violation_definitions())

            self.application.default_violations_values.update(
                validator.get_default_violations_values(self.application.config)
            )

        Key.insert_keys(
            self.application.db,
            self.application.violation_definitions,
            self.application.default_violations_values
        )

        self.application.event_bus = EventBus(self.application)
        self.application.http_client = AsyncHTTPClient(io_loop=io_loop)

        self.application.cache = Cache(self.application)

        self.configure_material_girl()

        self.configure_i18n()

        DomainsViolationsPrefs.insert_default_violations_values_for_all_domains(
            self.application.db,
            self.application.default_violations_values,
            self.application.violation_definitions,
            self.application.cache
        )
コード例 #4
0
    def after_start(self, io_loop):
        if self.db is not None:
            self.application.db = self.db
        else:
            self.application.db = self.application.get_sqlalchemy_session()

        if self.debug:
            from sqltap import sqltap
            self.sqltap = sqltap.start()

        authnz_wrapper_class = self._load_authnz_wrapper()
        if authnz_wrapper_class:
            self.application.authnz_wrapper = authnz_wrapper_class(
                self.application.config)
        else:
            self.application.authnz_wrapper = None

        self.application.facters = self._load_facters()
        self.application.validators = self._load_validators()
        self.application.error_handlers = [
            handler(self.application.config)
            for handler in self._load_error_handlers()
        ]

        self.application.search_provider = self._load_search_provider()(
            config=self.application.config,
            db=self.application.db,
            authnz_wrapper=self.application.authnz_wrapper,
            io_loop=io_loop)

        self.application.fact_definitions = {}
        self.application.violation_definitions = {}

        self.application.default_violations_values = {}

        for facter in self.application.facters:
            self.application.fact_definitions.update(
                facter.get_fact_definitions())

        Key.insert_keys(self.application.db, self.application.fact_definitions)

        for validator in self.application.validators:
            self.application.violation_definitions.update(
                validator.get_violation_definitions())

            self.application.default_violations_values.update(
                validator.get_default_violations_values(
                    self.application.config))

        Key.insert_keys(self.application.db,
                        self.application.violation_definitions,
                        self.application.default_violations_values)

        self.application.event_bus = EventBus(self.application)
        self.application.http_client = AsyncHTTPClient(io_loop=io_loop)

        self.application.cache = Cache(self.application)

        self.configure_material_girl()

        self.configure_i18n()

        DomainsViolationsPrefs.insert_default_violations_values_for_all_domains(
            self.application.db, self.application.default_violations_values,
            self.application.violation_definitions, self.application.cache)