do not rely on pkg_resources (#46549)
gitea/authentic2-cut/pipeline/head This commit looks good Details

This commit is contained in:
Emmanuel Cazenave 2020-09-10 17:23:29 +02:00
parent fe54bd6692
commit 87585964f5
6 changed files with 23 additions and 25 deletions

6
README
View File

@ -33,7 +33,11 @@ the git hook.)
Settings
========
Nothing to say here.
Register the plugin in your settings file.
INSTALLED_APPS += ('sorl.thumbnail', 'authentic2_cut',)
TENANT_APPS += ('sorl.thumbnail', 'authentic2_cut',)
MIDDLEWARE += ('authentic2_cut.middlewares.CUTMiddleware',)
License
-------

View File

@ -12,6 +12,8 @@ DATABASES = {
'ENGINE': 'django.db.backends.dummy',
}
}
INSTALLED_APPS += ('authentic2_cut',)
MIDDLEWARE += ('authentic2_cut.middlewares.CUTMiddleware',)
EOF
TEMPFILE=`mktemp`
trap "rm -f ${TEMPFILE} ${CHECK_MIGRATIONS_SETTINGS}" EXIT

View File

@ -110,11 +110,6 @@ setup(
'Pillow',
'sorl-thumbnail',
],
entry_points={
'authentic2.plugin': [
'authentic2-cut = authentic2_cut:Plugin',
],
},
cmdclass={
'build': build,
'install_lib': install_lib,

View File

@ -16,22 +16,3 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
default_app_config = 'authentic2_cut.apps.AppConfig'
class Plugin:
def get_before_urls(self):
from . import urls
return urls.urlpatterns
def get_apps(self):
return ['sorl.thumbnail', __name__]
def get_authentication_backends(self):
return []
def get_auth_frontends(self):
return []
def get_after_middleware(self):
return ['authentic2_cut.middlewares.CUTMiddleware']

View File

@ -790,3 +790,13 @@ class AppConfig(django.apps.AppConfig):
'href': reverse_lazy('cut-manager-user-validation'),
'class': 'icon-management',
}
def get_a2_plugin(self):
return Plugin()
class Plugin:
def get_before_urls(self):
from . import urls
return urls.urlpatterns

View File

@ -20,3 +20,9 @@ A2_FC_CLIENT_SECRET = ''
# test hook handlers
A2_HOOKS_PROPAGATE_EXCEPTIONS = True
INSTALLED_APPS += (
'sorl.thumbnail',
'authentic2_cut',
)
MIDDLEWARE += ('authentic2_cut.middlewares.CUTMiddleware',)