Пример #1
0
    def __init__(self, global_config:dict, settings:dict=None):
        """
        :param global_config: Dictionary as passed to WSGI entry point.

        :param settings: DEPRECATED. Extra settings as passed to WSGI entry point. TODO: How to handle these?
        """
        if not settings:
            settings = IncludeAwareConfigParser.retrofit_settings(global_config)

        #: This is the refer    ence to the config file which started our process. We need to later pass it to Notebook.
        settings["websauna.global_config"] = global_config
        self.global_config = global_config

        #: Reference to Celery app instance
        self.celery = None

        self.settings = settings
        self.config = self.create_configurator()

        self.config.registry.static_asset_policy = self.static_asset_policy = self.create_static_asset_policy()

        #: Flag to tell if we need to do sanity check for redis sessiosn
        self._has_redis_sessions = False

        #: This flag keeps state if the initializer has been run or not.
        self._already_run = False
Пример #2
0
    def __init__(self, global_config: dict, settings: Optional[dict] = None):
        """
        :param global_config: Dictionary as passed to WSGI entry point.

        :param settings: DEPRECATED. Extra settings as passed to WSGI entry point. TODO: How to handle these?
        """
        if not settings:
            settings = IncludeAwareConfigParser.retrofit_settings(
                global_config)

        #: This is the refer    ence to the config file which started our process. We need to later pass it to Notebook.
        settings["websauna.global_config"] = global_config
        self.global_config = global_config

        #: Reference to Celery app instance
        self.celery = None

        self.settings = settings
        self.config = self.create_configurator()

        self.config.registry.static_asset_policy = self.static_asset_policy = self.create_static_asset_policy(
        )

        #: Flag to tell if we need to do sanity check for redis sessiosn
        self._has_redis_sessions = False

        #: This flag keeps state if the initializer has been run or not.
        self._already_run = False

        # Exposed Websauna features
        self.config.registry.features = set()
Пример #3
0
    def __init__(self, global_config:dict, settings:dict=None, configurator:Configurator=None):
        """

        :param global_config: Dictionary as passed to WSGI entry point.

        :param settings: DEPRECATED. Extra settings as passed to WSGI entry point. TODO: How to handle these?

        :param config: Configurator passed by another Pyramid app entry point. If given use this. If not given extra the config file from ``global_config`` and then create a ``Configurator`` for it. This is usually given when Initializer is used with addon.
        """
        if not settings:
            settings = IncludeAwareConfigParser.retrofit_settings(global_config)

        #: This is the refer    ence to the config file which started our process. We need to later pass it to Notebook.
        settings["websauna.global_config"] = global_config
        self.global_config = global_config

        self.config = self.create_configurator(settings)

        #: Python module which provides Horus models
        self.user_models_module = None

        #: Reference to Celery app instance
        self.celery = None

        self.settings = settings

        #: Flag to tell if we need to do sanity check for redis sessiosn
        self._has_redis_sessions = False