Projet

Général

Profil

0001-misc-load-plugins-through-django-s-application-regis.patch

Emmanuel Cazenave, 08 septembre 2020 17:08

Télécharger (1,25 ko)

Voir les différences:

Subject: [PATCH] misc: load plugins through django's application registry when
 possible (#46474)

 src/authentic2/plugins.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
src/authentic2/plugins.py
22 22
import pkg_resources
23 23
import logging
24 24

  
25

  
25
from django.apps import apps
26 26
from django.conf.urls import include, url
27 27

  
28 28

  
......
57 57
            logger.exception('unable to load entrypoint %s', entrypoint)
58 58
            raise PluginError('unable to load entrypoint %s' % entrypoint, e)
59 59
        plugins.append(plugin_callable(*args, **kwargs))
60
    PLUGIN_CACHE[group_name] = plugins
60

  
61
    if apps.ready:
62
        for app_config in apps.get_app_configs():
63
            if hasattr(app_config, 'get_a2_plugin'):
64
                plugins.append(app_config.get_a2_plugin())
65
        PLUGIN_CACHE[group_name] = plugins
66

  
61 67
    return plugins
62 68

  
63 69

  
64
-