Python oslo_i18n 模块,enable_lazy() 实例源码

我们从Python开源项目中,提取了以下8个代码示例,用于说明如何使用oslo_i18n.enable_lazy()

项目:panko    作者:openstack    | 项目源码 | 文件源码
def prepare_service(argv=None, config_files=None, share=False):
    conf = cfg.ConfigOpts()
    for group, options in opts.list_opts():
        conf.register_opts(list(options),
                           group=None if group == "DEFAULT" else group)
    db_options.set_defaults(conf)
    if not share:
        defaults.set_cors_middleware_defaults()
        oslo_i18n.enable_lazy()
        log.register_options(conf)

    if argv is None:
        argv = sys.argv
    conf(argv[1:], project='panko', validate_default_values=True,
         version=version.version_info.version_string(),
         default_config_files=config_files)

    if not share:
        log.setup(conf, 'panko')
    # NOTE(liusheng): guru cannot run with service under apache daemon, so when
    # panko-api running with mod_wsgi, the argv is [], we don't start
    # guru.
    if argv:
        gmr.TextGuruMeditation.setup_autorun(version)
    return conf
项目:vdi-broker    作者:cloudbase    | 项目源码 | 文件源码
def enable_lazy(enable=True):
    return i18n.enable_lazy(enable)
项目:meteos    作者:openstack    | 项目源码 | 文件源码
def enable_lazy():
    return oslo_i18n.enable_lazy()
项目:coriolis    作者:cloudbase    | 项目源码 | 文件源码
def enable_lazy(enable=True):
    return i18n.enable_lazy(enable)
项目:python-adjutantclient    作者:openstack    | 项目源码 | 文件源码
def enable_lazy():
    return oslo_i18n.enable_lazy()
项目:python-hpedockerplugin    作者:hpe-storage    | 项目源码 | 文件源码
def enable_lazy(enable=True):
    return i18n.enable_lazy(enable)
项目:ranger-agent    作者:openstack    | 项目源码 | 文件源码
def prepare_service(argv=None):
    i18n.enable_lazy()
    log_levels = (cfg.CONF.default_log_levels +
                  ['stevedore=INFO'])
    cfg.set_defaults(log.log_opts,
                     default_log_levels=log_levels)
    if argv is None:
        argv = sys.argv
    cfg.CONF(argv[1:], project='ord', validate_default_values=True)
    log.setup('ord')
    # messaging.setup()
项目:meteos    作者:openstack    | 项目源码 | 文件源码
def setUp(self):
        """Run before each test method to initialize test environment."""
        super(TestCase, self).setUp()

        oslo_i18n.enable_lazy(enable=False)
        conf_fixture.set_defaults(CONF)
        CONF([], default_config_files=[])

        global _DB_CACHE
        if not _DB_CACHE:
            _DB_CACHE = Database(
                db_api,
                migration,
                sql_connection=CONF.database.connection,
                sqlite_db=CONF.sqlite_db,
                sqlite_clean_db=CONF.sqlite_clean_db,
            )
        self.useFixture(_DB_CACHE)

        self.injected = []
        self._services = []
        self.flags(fatal_exception_format_errors=True)
        # This will be cleaned up by the NestedTempfile fixture
        lock_path = self.useFixture(fixtures.TempDir()).path
        self.fixture = self.useFixture(config_fixture.Config(lockutils.CONF))
        self.fixture.config(lock_path=lock_path, group='oslo_concurrency')
        self.fixture.config(
            disable_process_locking=True, group='oslo_concurrency')

        rpc.add_extra_exmods('meteos.tests')
        self.addCleanup(rpc.clear_extra_exmods)
        self.addCleanup(rpc.cleanup)

        self.messaging_conf = messaging_conffixture.ConfFixture(CONF)
        self.messaging_conf.transport_driver = 'fake'
        self.messaging_conf.response_timeout = 15
        self.useFixture(self.messaging_conf)
        rpc.init(CONF)

        mock.patch('keystoneauth1.loading.load_auth_from_conf_options').start()

        fake_notifier.stub_notifier(self)