def make_fanstatic(app, global_config, **local_config): local_config = convert_config(local_config) # Look up injector factory by name. injector_name = local_config.pop('injector', 'topbottom') injector_factory = fanstatic.registry.InjectorRegistry.instance().get(injector_name) if injector_factory is None: raise ConfigurationError('No injector found for name %s' % injector_name) injector = injector_factory(local_config) return Fanstatic(app, injector=injector, **local_config)
def fanstatic_config(config, prefix='fanstatic.'): cfg = { 'publisher_signature': fanstatic.DEFAULT_SIGNATURE, 'injector': 'topbottom', } for k, v in config.items(): if k.startswith(prefix): cfg[k[len(prefix):]] = v return convert_config(cfg)
def fanstatic_config(config, prefix='fanstatic.'): cfg = { 'publisher_signature': fanstatic.DEFAULT_SIGNATURE, 'injector': 'topbottom', } for k, v in config.items(): if k.startswith(prefix): cfg[k[len(prefix):]] = v return convert_config(cfg)
def test_convert_config(): d = { 'versioning': 't', 'recompute_hashes': 'false', 'bottom': 'True', 'force_bottom': 'False', 'rollup': 0, 'somethingelse': 'True', } assert convert_config(d) == { 'versioning': True, 'recompute_hashes': False, 'bottom': True, 'force_bottom': False, 'rollup': False, 'somethingelse': 'True', }
def fanstatic_config(config, prefix="fanstatic."): cfg = {"publisher_signature": fanstatic.DEFAULT_SIGNATURE, "injector": "topbottom"} for k, v in config.items(): if k.startswith(prefix): cfg[k[len(prefix) :]] = v return convert_config(cfg)
def make_injector(app, global_config, **local_config): local_config = convert_config(local_config) return Injector(app, **local_config)
def make_fanstatic(app, global_config, **local_config): local_config = convert_config(local_config) return Fanstatic(app, **local_config)
def make_injector(app, global_config, **local_config): local_config = convert_config(local_config) return Injector(app, **local_config)