django-configurations/configurations
Simon Kohlmeyer 7af5af0dd6 Fix interaction with procrastinate
This monkey-patching broke procrastinate in an interesting way:

Procrastinate uses the add_arguments hook to check the previously
defined arguments like this:

```python
class Command(BaseCommand):
    def add_arguments(self, parser):
      self._django_options = {a.dest for a in parser._actions}
      ...
```

in order to later filter them out like this:

```python
  def handle(self, *args, **kwargs):
    ...
    kwargs = {k: v for k, v in kwargs.items() if k not in self._django_options}
    ...
```

This is a problem because the CONFIGURATION_ARGUMENT arg is added
*after* procrastinate's `add_arguments` is called. Here's the call
graph:

```
  create_parser (django-configurations)
  -> create_parser (django) (a.k.a. orig_create_parser)
    -> add_arguments (procrastinate)
    -> (CONFIGURATION_ARGUMENT added here)
```

This commit esesentially swaps the inner two actions so it looks like
this:

```
  create_parser (django-configurations)
  -> create_parser (django) (a.k.a. orig_create_parser)
    -> (CONFIGURATION_ARGUMENT added here)
    -> add_arguments (procrastinate)
```

It does this by temporarily overriding `add_arguments` with a no-op and
then later restoring and calling it.

This is a hack on top of two hacks, but I can't really see any other
ways to make it work.
2025-02-20 16:38:44 +01:00
..
__init__.py Switch to setuptools-scm. 2019-12-03 13:09:15 +01:00
__main__.py Added "python -m configurations" entry point. 2021-10-27 07:29:02 +06:00
asgi.py Suppress import ordering style error 2021-10-25 09:34:42 -04:00
base.py Prevent FORMS_URLFIELD_ASSUME_HTTPS warning on Django 5.0 2024-11-18 11:37:17 +00:00
decorators.py Renamed Settings class to Configuration to better match what it means. Settings is still importable and is marked to be deprecated in 1.0. 2013-07-27 12:05:39 +02:00
fastcgi.py Add a fastcgi helper. Fixes #19. 2013-03-27 16:57:05 +01:00
importer.py Fix interaction with procrastinate 2025-02-20 16:38:44 +01:00
management.py Added configurations.management.call_command. Fix #72. 2015-01-06 21:38:08 +01:00
sphinx.py Move sphinx callback to a separate sphinx submodule 2016-06-13 12:26:52 +02:00
utils.py really drop support for python<=3.7 2024-03-18 16:08:42 +00:00
values.py really drop support for python<=3.7 2024-03-18 16:08:42 +00:00
version.py Fix #368 -- Update Python and Django versions 2023-10-04 16:52:16 +02:00
wsgi.py Simplify import of django.core.wsgi.get_wsgi_application 2021-10-25 09:52:21 -04:00