From 9fff4e1f7fc7db7e227aed93b300be3175f5cc64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89loi=20Rivard?= Date: Thu, 12 Dec 2024 22:02:46 +0100 Subject: [PATCH] doc: fix invalid references --- CHANGES.rst | 10 +++--- canaille/__init__.py | 16 +++++++++- canaille/backends/models.py | 4 +-- canaille/core/configuration.py | 4 +-- doc/locales/doc.pot | 53 +++++++++++++++++--------------- doc/references/configuration.rst | 4 ++- 6 files changed, 56 insertions(+), 35 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index dbb8371c..51d26ed9 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -12,7 +12,7 @@ Added - Password compromission check :issue:`179` - :attr:`~canaille.core.configuration.CoreSettings.ADMIN_EMAIL` and :attr:`~canaille.core.configuration.CoreSettings.ENABLE_PASSWORD_COMPROMISSION_CHECK` and - :attr:`~canaille.core.configuration.CoreSettings.API_URL_HIBP` + :attr:`~canaille.core.configuration.CoreSettings.PASSWORD_COMPROMISSION_CHECK_API_URL` :issue:`179` - Implement OIDC client_credentials flow. :issue:`207` - Button in the client admin page to create client tokens. @@ -32,8 +32,8 @@ Fixed Added ^^^^^ -- :attr:`~canaille.core.configuration.CoreSettings.MAX_PASSWORD_LENGHT` and - :attr:`~canaille.core.configuration.CoreSettings.MIN_PASSWORD_LENGHT` configuration options :issue:`174` +- :attr:`~canaille.core.configuration.CoreSettings.MAX_PASSWORD_LENGTH` and + :attr:`~canaille.core.configuration.CoreSettings.MIN_PASSWORD_LENGTH` configuration options :issue:`174` - Password strength visual indicator. :issue:`174` - Security events logs. :issue:`177` - Support for Python 3.13. :pr:`186` @@ -79,7 +79,7 @@ Fixed Added ^^^^^ -- `env_prefix` :meth:`~canaille.create_app` variable can select the environment var prefix. +- `env_prefix` `create_app`` variable can select the environment var prefix. [0.0.52] - 2024-04-22 --------------------- @@ -146,7 +146,7 @@ Fixed Changed ^^^^^^^ -- Internal indexation mechanism of :class:`~canaille.backends.memory.model.MemoryModel`. +- Internal indexation mechanism of ``MemoryModel``. [0.0.44] - 2024-03-29 --------------------- diff --git a/canaille/__init__.py b/canaille/__init__.py index 3a87d05a..5d42f7b3 100644 --- a/canaille/__init__.py +++ b/canaille/__init__.py @@ -85,7 +85,21 @@ def setup_flask_converters(app): app.url_map.converters[model_name.lower()] = model_converter(model_class) -def create_app(config=None, validate=True, backend=None, env_file=None, env_prefix=""): +def create_app( + config: dict = None, + validate: bool = True, + backend=None, + env_file: str = None, + env_prefix: str = "", +): + """Application entry point. + + :param config: A configuration dict. This will take priority over any other configuration method. + :param validate: Whether to validate or not the configuration. + :param backend: An optional backend to force. If unset backend will be initialized according to the configuration. + :param env_file: The path to an environment var file in which configuration can be loaded. + :param env_prefix: The prefix to configuration environment vars. + """ from .app.configuration import setup_config from .app.features import setup_features from .app.i18n import setup_i18n diff --git a/canaille/backends/models.py b/canaille/backends/models.py index bce8c00a..805f1df9 100644 --- a/canaille/backends/models.py +++ b/canaille/backends/models.py @@ -29,8 +29,8 @@ class Model: id: str | None = None """A unique identifier for a SCIM resource as defined by the service - provider. Id will be :py:data:`None` until the - :meth:`~canaille.backends.models.BackendModel.save` method is called. + provider. Id will be :data:`None` until the + ``Backend.save`` method is called. Each representation of the resource MUST include a non-empty "id" value. This identifier MUST be unique across the SCIM service diff --git a/canaille/core/configuration.py b/canaille/core/configuration.py index 64e21137..c6d467e7 100644 --- a/canaille/core/configuration.py +++ b/canaille/core/configuration.py @@ -269,8 +269,8 @@ class CoreSettings(BaseModel): OTP_METHOD: str = None """If OTP_METHOD is defined, then users will need to authenticate themselves using a one-time password (OTP) via an authenticator app. - If set to :py:data:`TOTP`, the application will use time one-time passwords, - If set to :py:data:`HOTP`, the application will use HMAC-based one-time passwords.""" + If set to ``TOTP``, the application will use time one-time passwords, + If set to ``HOTP``, the application will use HMAC-based one-time passwords.""" EMAIL_OTP: bool = False """If :py:data:`True`, then users will need to authenticate themselves diff --git a/doc/locales/doc.pot b/doc/locales/doc.pot index cf667296..9dd5bc04 100644 --- a/doc/locales/doc.pot +++ b/doc/locales/doc.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: canaille 0.0.56\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-12 12:02+0100\n" +"POT-Creation-Date: 2024-12-12 22:02+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -114,7 +114,7 @@ msgstr "" #: ../../CHANGES.rst:13 #: a90b270f7e144a4b81babbac96f5ff22 -msgid ":attr:`~canaille.core.configuration.CoreSettings.ADMIN_EMAIL` and :attr:`~canaille.core.configuration.CoreSettings.ENABLE_PASSWORD_COMPROMISSION_CHECK` and :attr:`~canaille.core.configuration.CoreSettings.API_URL_HIBP` :issue:`179`" +msgid ":attr:`~canaille.core.configuration.CoreSettings.ADMIN_EMAIL` and :attr:`~canaille.core.configuration.CoreSettings.ENABLE_PASSWORD_COMPROMISSION_CHECK` and :attr:`~canaille.core.configuration.CoreSettings.PASSWORD_COMPROMISSION_CHECK_API_URL` :issue:`179`" msgstr "" #: ../../CHANGES.rst:17 @@ -286,7 +286,7 @@ msgstr "" #: ../../CHANGES.rst:35 #: efa1fc20329f42918fe6a530617cf102 -msgid ":attr:`~canaille.core.configuration.CoreSettings.MAX_PASSWORD_LENGHT` and :attr:`~canaille.core.configuration.CoreSettings.MIN_PASSWORD_LENGHT` configuration options :issue:`174`" +msgid ":attr:`~canaille.core.configuration.CoreSettings.MAX_PASSWORD_LENGTH` and :attr:`~canaille.core.configuration.CoreSettings.MIN_PASSWORD_LENGTH` configuration options :issue:`174`" msgstr "" #: ../../CHANGES.rst:37 @@ -385,7 +385,7 @@ msgstr "" #: ../../CHANGES.rst:82 #: 17fbf739a68a4e59b5cc6da8befa1c6f -msgid "`env_prefix` :meth:`~canaille.create_app` variable can select the environment var prefix." +msgid "`env_prefix` `create_app`` variable can select the environment var prefix." msgstr "" #: ../../CHANGES.rst:85 @@ -490,7 +490,7 @@ msgstr "" #: ../../CHANGES.rst:149 #: 9690ab893eef4290a52b1137f24b9be8 -msgid "Internal indexation mechanism of :class:`~canaille.backends.memory.model.MemoryModel`." +msgid "Internal indexation mechanism of ``MemoryModel``." msgstr "" #: ../../CHANGES.rst:152 @@ -3965,14 +3965,14 @@ msgstr "" msgid "Configuration file" msgstr "" -#: ../references/configuration.rst:12 +#: ../references/configuration.rst:14 #: 0fc2b0bc764345caba3f9402376e279a msgid "The configuration can be written in `toml` configuration file which path is passed in the :envvar:`CONFIG` environment variable." msgstr "" #: ../../canaille/app/configuration.py:docstring of canaille.app.configuration.RootSettings:11 -#: ../references/configuration.rst:14 -#: ../references/configuration.rst:96 +#: ../references/configuration.rst:16 +#: ../references/configuration.rst:98 #: ../tutorial/databases.rst:23 #: ../tutorial/databases.rst:37 #: ../tutorial/databases.rst:138 @@ -3985,62 +3985,62 @@ msgstr "" msgid "config.toml" msgstr "" -#: ../references/configuration.rst:26 +#: ../references/configuration.rst:28 #: 4b63b3891e1c45788780ea1af554d1db msgid "You can have a look at the :ref:`example file ` for inspiration." msgstr "" -#: ../references/configuration.rst:29 +#: ../references/configuration.rst:31 #: 8cbac0cd9e3e4bc3ad5fc60d82180568 msgid "Environment variables" msgstr "" -#: ../references/configuration.rst:31 +#: ../references/configuration.rst:33 #: b909831b5aed44a4b439b37701feabb7 msgid "In addition, parameters that have not been set in the configuration file can be read from environment variables. The way environment variables are parsed can be read from the `pydantic-settings documentation `_." msgstr "" -#: ../references/configuration.rst:36 +#: ../references/configuration.rst:38 #: fd22a354c18f4733b8b1962cfcbe2139 msgid "For environment vars, the separator between sections and variables is a double underscore: ``__``. For instance, the ``NAME`` var in the ``CANAILLE`` section shown above is ``CANAILLE__NAME``." msgstr "" -#: ../references/configuration.rst:40 +#: ../references/configuration.rst:42 #: f12f0cbb606e4627be2fa3b2a895f162 msgid "Environment file" msgstr "" -#: ../references/configuration.rst:42 +#: ../references/configuration.rst:44 #: 434c11ee0d6a4a118f9b8802d407d447 msgid "Any environment variable can also be written in an environment file, which path should be passed in the ``ENV_FILE`` environment variable. For instance, set ``ENV_FILE=.env`` to load a ``.env`` file." msgstr "" -#: ../references/configuration.rst:45 +#: ../references/configuration.rst:47 #: 83d91b20c3204d09b61a4a6de8c84769 msgid ".env" msgstr "" -#: ../references/configuration.rst:63 +#: ../references/configuration.rst:65 #: 8fc48610072c4e248c494befe2a4c8f6 msgid "Configuration methods priority" msgstr "" -#: ../references/configuration.rst:65 +#: ../references/configuration.rst:67 #: d3fdde7c8d9841e49e92bcba763e33d8 msgid "If a same configuration option is defined by different ways, here is how Canaille will choose which one to use:" msgstr "" -#: ../references/configuration.rst:67 +#: ../references/configuration.rst:69 #: b79bfecad485446b85a8866657222448 msgid "environment vars have priority over the environment file and the configuration file;" msgstr "" -#: ../references/configuration.rst:68 +#: ../references/configuration.rst:70 #: 63800f5a14d44e1fa3ed0266e19f5482 msgid "environment file will have priority over the configuration file." msgstr "" -#: ../references/configuration.rst:71 +#: ../references/configuration.rst:73 #: e8e7a0f78d68479a9586036adf25e183 msgid "Parameters" msgstr "" @@ -4330,7 +4330,7 @@ msgstr "" #: ../../docstring of canaille.core.configuration.CoreSettings.OTP_METHOD:1 #: 622f83bdd580459cad5b3b328fb2de3b -msgid "If OTP_METHOD is defined, then users will need to authenticate themselves using a one-time password (OTP) via an authenticator app. If set to :py:data:`TOTP`, the application will use time one-time passwords, If set to :py:data:`HOTP`, the application will use HMAC-based one-time passwords." +msgid "If OTP_METHOD is defined, then users will need to authenticate themselves using a one-time password (OTP) via an authenticator app. If set to ``TOTP``, the application will use time one-time passwords, If set to ``HOTP``, the application will use HMAC-based one-time passwords." msgstr "" #: ../../docstring of canaille.core.configuration.CoreSettings.PASSWORD_COMPROMISSION_CHECK_API_URL:1 @@ -4785,12 +4785,12 @@ msgstr "" msgid "The attribute to identify an object in the User DN." msgstr "" -#: ../references/configuration.rst:92 +#: ../references/configuration.rst:94 #: c4674c5a1b434e81944983c7ec2fb0f1 msgid "Example file" msgstr "" -#: ../references/configuration.rst:94 +#: ../references/configuration.rst:96 #: 87c3dcb2ef5a4f649ec0fa9005449a79 msgid "Here is a configuration file example:" msgstr "" @@ -4844,7 +4844,7 @@ msgstr "" #: ../../docstring of canaille.backends.models.Model.id:1 #: 112d9fd0a032418682875fe5f5685fc8 -msgid "A unique identifier for a SCIM resource as defined by the service provider. Id will be :py:data:`None` until the :meth:`~canaille.backends.models.BackendModel.save` method is called." +msgid "A unique identifier for a SCIM resource as defined by the service provider. Id will be :data:`None` until the ``Backend.save`` method is called." msgstr "" #: ../../docstring of canaille.backends.models.Model.id:5 @@ -5450,6 +5450,11 @@ msgstr "" msgid "OpenID Connect token definition." msgstr "" +#: ../references/templates.rst:2 +#: 25d974aba30140f4ad6e3445c3d71f50 +msgid "Templates" +msgstr "" + #: ../tutorial/databases.rst:4 #: 2934007ee99c4b5096855dd9bf47208b msgid "Canaille can read and save data in different databases. This page presents the different database backends and their specificities:" diff --git a/doc/references/configuration.rst b/doc/references/configuration.rst index 43219ae7..761bd864 100644 --- a/doc/references/configuration.rst +++ b/doc/references/configuration.rst @@ -9,7 +9,9 @@ Canaille can be configured either by a environment variables, environment file, Configuration file ~~~~~~~~~~~~~~~~~~ -The configuration can be written in `toml` configuration file which path is passed in the :envvar:`CONFIG` environment variable. +.. envvar:: CONFIG + + The configuration can be written in `toml` configuration file which path is passed in the :envvar:`CONFIG` environment variable. .. code-block:: toml :caption: config.toml