Example #1
0
def query(request):
    ConfigService.setup_default_values()
    pairs = []
    for value in request.GET.getall('filter'):
        split = value.split(':', 1)
        pairs.append({'key': split[0], 'section': split[1]})
    return [c for c in ConfigService.filtered_key_and_section(pairs)]
Example #2
0
def query(request):
    ConfigService.setup_default_values()
    pairs = []
    for value in request.GET.getall("filter"):
        split = value.split(":", 1)
        pairs.append({"key": split[0], "section": split[1]})
    return [c for c in ConfigService.filtered_key_and_section(pairs)]
Example #3
0
def default_data(base_app):
    from appenlight.models.services.config import ConfigService
    from appenlight.lib import get_callable
    transaction.begin()
    ConfigService.setup_default_values()
    for plugin_name, config in base_app.registry.appenlight_plugins.items():
        if config['default_values_setter']:
            get_callable(config['default_values_setter'])()
    transaction.commit()
Example #4
0
def main(argv=sys.argv):
    parser = argparse.ArgumentParser(
        description="Migrate AppEnlight database to latest version",
        add_help=False)
    parser.add_argument("-c",
                        "--config",
                        required=True,
                        help="Configuration ini file of application")
    args = parser.parse_args()
    config_uri = args.config

    setup_logging(config_uri)
    bootstrap(config_uri)
    registry = get_current_registry()
    alembic_cfg = Config()
    alembic_cfg.set_main_option("sqlalchemy.echo", "true")
    alembic_cfg.set_main_option("script_location",
                                "ziggurat_foundations:migrations")
    alembic_cfg.set_main_option("sqlalchemy.url",
                                registry.settings["sqlalchemy.url"])
    command.upgrade(alembic_cfg, "head")
    alembic_cfg = Config()
    alembic_cfg.set_main_option("sqlalchemy.echo", "true")
    alembic_cfg.set_main_option("script_location", "appenlight:migrations")
    alembic_cfg.set_main_option("sqlalchemy.url",
                                registry.settings["sqlalchemy.url"])
    command.upgrade(alembic_cfg, "head")

    for plugin_name, config in registry.appenlight_plugins.items():
        if config["sqlalchemy_migrations"]:
            alembic_cfg = Config()
            alembic_cfg.set_main_option("script_location",
                                        config["sqlalchemy_migrations"])
            alembic_cfg.set_main_option("sqlalchemy.url",
                                        registry.settings["sqlalchemy.url"])
            alembic_cfg.set_main_option("sqlalchemy.echo", "true")
            command.upgrade(alembic_cfg, "head")

    with get_current_request().tm:
        ConfigService.setup_default_values()

        for plugin_name, config in registry.appenlight_plugins.items():
            if config["default_values_setter"]:
                get_callable(config["default_values_setter"])()