Skip to content

Commit

Permalink
Fix URL login arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Sep 12, 2024
1 parent 58bc66c commit 41f3c64
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions geoportal/c2cgeoportal_geoportal/scripts/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2011-2021, Camptocamp SA
# Copyright (c) 2011-2024, Camptocamp SA
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -38,12 +38,14 @@
from sqlalchemy.orm import Session, configure_mappers, sessionmaker


def fill_arguments(parser: ArgumentParser) -> None:
def fill_arguments(parser: ArgumentParser, use_attribute: bool = False) -> None:
"""Fill the command line argument description."""
default_config_uri = (
"c2c://development.ini" if os.path.isfile("development.ini") else "c2c://geoportal/development.ini"
)
c2cwsgiutils.setup_process.fill_arguments(parser, default_config_uri=default_config_uri)
c2cwsgiutils.setup_process.fill_arguments(
parser, default_config_uri=default_config_uri, use_attribute=use_attribute
)


def get_appsettings(options: Namespace) -> pyramid.config.Configurator:
Expand Down
4 changes: 2 additions & 2 deletions geoportal/c2cgeoportal_geoportal/scripts/urllogin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2012-2021, Camptocamp SA
# Copyright (c) 2012-2024, Camptocamp SA
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -58,7 +58,7 @@ def get_argparser() -> argparse.ArgumentParser:
"""Get the argument parser for this script."""

parser = argparse.ArgumentParser(description="Generate an auth token")
fill_arguments(parser)
fill_arguments(parser, use_attribute=True)
parser.add_argument("user", help="The username")
parser.add_argument("password", help="The password")
parser.add_argument("valid", type=int, default=1, nargs="?", help="Is valid for, in days")
Expand Down

0 comments on commit 41f3c64

Please sign in to comment.