Esempio n. 1
0
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)
Esempio n. 3
0
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)
Esempio n. 4
0
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',
        }
Esempio n. 5
0
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)
Esempio n. 6
0
def make_injector(app, global_config, **local_config):
    local_config = convert_config(local_config)
    return Injector(app, **local_config)
Esempio n. 7
0
def make_fanstatic(app, global_config, **local_config):
    local_config = convert_config(local_config)
    return Fanstatic(app, **local_config)
Esempio n. 8
0
def make_injector(app, global_config, **local_config):
    local_config = convert_config(local_config)
    return Injector(app, **local_config)