forked from CGM_Public/pretix_original
Added deprecation warning for old-style urlconfigs in plugins
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import importlib.util
|
||||
import warnings
|
||||
|
||||
from django.apps import apps
|
||||
from django.conf.urls import include, url
|
||||
@@ -31,6 +32,9 @@ for app in apps.get_app_configs():
|
||||
url(r'^(?P<organizer>[^/]+)/(?P<event>[^/]+)/', include(urlmod.event_patterns, namespace=app.label))
|
||||
)
|
||||
elif importlib.util.find_spec(app.name + '.maindomain_urls'):
|
||||
warnings.warn('Please put your config in an \'urls\' module using the urlpatterns and event_patterns '
|
||||
'attribute. Support for maindomain_urls in plugins will be dropped in the future.',
|
||||
DeprecationWarning)
|
||||
urlmod = importlib.import_module(app.name + '.maindomain_urls')
|
||||
raw_plugin_patterns.append(
|
||||
url(r'', include(urlmod, namespace=app.label))
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import importlib
|
||||
import importlib.util
|
||||
import warnings
|
||||
|
||||
from django.apps import apps
|
||||
from django.conf.urls import include, url
|
||||
|
||||
from pretix.presale.urls import (
|
||||
event_patterns, locale_patterns, organizer_patterns,
|
||||
)
|
||||
@@ -26,6 +25,9 @@ for app in apps.get_app_configs():
|
||||
url(r'^(?P<event>[^/]+)/', include(urlmod.event_patterns, namespace=app.label))
|
||||
)
|
||||
elif importlib.util.find_spec(app.name + '.subdomain_urls'):
|
||||
warnings.warn('Please put your config in an \'urls\' module using the event_patterns '
|
||||
'attribute. Support for subdomain_urls in plugins will be dropped in the future.',
|
||||
DeprecationWarning)
|
||||
urlmod = importlib.import_module(app.name + '.subdomain_urls')
|
||||
raw_plugin_patterns.append(
|
||||
url(r'', include(urlmod, namespace=app.label))
|
||||
|
||||
Reference in New Issue
Block a user