Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/cli/admin.py
# Copyright (C) 2017-2020 The Software Heritage developers | # Copyright (C) 2017-2020 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
# WARNING: do not import unnecessary things here to keep cli startup time under | |||||
# control | |||||
import click | import click | ||||
from swh.deposit.config import setup_django_for | |||||
from swh.deposit.cli import deposit | from swh.deposit.cli import deposit | ||||
@deposit.group("admin") | @deposit.group("admin") | ||||
@click.option( | @click.option( | ||||
"--config-file", | "--config-file", | ||||
"-C", | "-C", | ||||
default=None, | default=None, | ||||
type=click.Path(exists=True, dir_okay=False,), | type=click.Path(exists=True, dir_okay=False,), | ||||
help="Optional extra configuration file.", | help="Optional extra configuration file.", | ||||
) | ) | ||||
@click.option( | @click.option( | ||||
"--platform", | "--platform", | ||||
default="development", | default="development", | ||||
type=click.Choice(["development", "production"]), | type=click.Choice(["development", "production"]), | ||||
help="development or production platform", | help="development or production platform", | ||||
) | ) | ||||
@click.pass_context | @click.pass_context | ||||
def admin(ctx, config_file, platform): | def admin(ctx, config_file, platform): | ||||
"""Server administration tasks (manipulate user or collections)""" | """Server administration tasks (manipulate user or collections)""" | ||||
from swh.deposit.config import setup_django_for | |||||
# configuration happens here | # configuration happens here | ||||
setup_django_for(platform, config_file=config_file) | setup_django_for(platform, config_file=config_file) | ||||
@admin.group("user") | @admin.group("user") | ||||
@click.pass_context | @click.pass_context | ||||
def user(ctx): | def user(ctx): | ||||
"""Manipulate user.""" | """Manipulate user.""" | ||||
▲ Show 20 Lines • Show All 235 Lines • Show Last 20 Lines |