コード例 #1
0
    def set_config(self, config_filename, conf, error):
        super(WSGIApp, self).set_config(config_filename, conf, error)
        conf = configobj.ConfigObj(
            conf, configspec=configobj.ConfigObj(self.ConfigSpec), interpolation='Template')
        config.validate(config_filename, conf, error)

        self._services = services.ServicesRepository(
            config_filename, error, conf
        )

        self.card_extensions = services.CardExtensions(
            config_filename, error, conf
        )

        self.as_root = conf['application']['as_root']
        self.app_title = unicode(conf['application']['title'], 'utf-8')
        self.app_name = conf['application']['name']
        self.theme = conf['application']['theme']
        self.application_path = conf['application']['path']

        # search_engine engine configuration
        self.search_engine = SearchEngine(**conf['search'])
        self._services.register('search_engine', self.search_engine)
        Card.update_schema(self.card_extensions)

        # Make assets_manager available to kansha-admin commands
        self.assets_manager = self._services['assets_manager']

        # other
        self.security = SecurityManager(conf['application']['crypto_key'])
        self.debug = conf['application']['debug']
        self.default_locale = i18n.Locale(
            conf['locale']['major'], conf['locale']['minor'])
        pub_cfg = {
            'disclaimer': conf['application']['disclaimer'].decode('utf-8'),
            'banner': conf['application']['banner'].decode('utf-8'),
            'favicon': conf['application']['favicon'].decode('utf-8')
        }
        self.app_config = {
            'authentication': conf['authentication'],
            'pub_cfg': pub_cfg
        }
        self.activity_monitor = conf['application']['activity_monitor']
コード例 #2
0
    def set_config(self, config_filename, conf, error):
        super(WSGIApp, self).set_config(config_filename, conf, error)
        conf = configobj.ConfigObj(conf,
                                   configspec=configobj.ConfigObj(
                                       self.ConfigSpec),
                                   interpolation='Template')
        config.validate(config_filename, conf, error)

        self._services = services.ServicesRepository(config_filename, error,
                                                     conf)

        self.as_root = conf['application']['as_root']
        self.app_title = unicode(conf['application']['title'], 'utf-8')
        self.theme = conf['application']['theme']
        self.application_path = conf['application']['path']

        # search_engine engine configuration
        self.search_engine = SearchEngine(**conf['search'])

        # other
        self.security = SecurityManager(conf['application']['crypto_key'])
        self.debug = conf['application']['debug']
        self.default_locale = i18n.Locale(conf['locale']['major'],
                                          conf['locale']['minor'])
        tpl_cfg = conf['application']['templates']
        pub_cfg = {
            'disclaimer': conf['application']['disclaimer'].decode('utf-8'),
            'banner': conf['application']['banner'].decode('utf-8'),
            'favicon': conf['application']['favicon'].decode('utf-8')
        }
        self.app_cfg = {
            'authentication': conf['authentication'],
            'tpl_cfg': tpl_cfg,
            'pub_cfg': pub_cfg
        }
        self.activity_monitor = conf['application']['activity_monitor']