forked from CGM_Public/pretix_original
Added a signal for processing event requests
This commit is contained in:
@@ -45,3 +45,19 @@ This signal is sent out to display additional information on the order detail pa
|
||||
|
||||
As with all plugin signals, the ``sender`` keyword argument will contain the event.
|
||||
"""
|
||||
|
||||
process_request = EventPluginSignal(
|
||||
providing_args=["request"]
|
||||
)
|
||||
"""
|
||||
This signal is sent out whenever a request is made to a event presale page. Most of the
|
||||
time, this will be called from the middleware layer (except on plugin-provided pages
|
||||
this will be caled by the @event_view decorator). Similarly to Django's process_request
|
||||
middleware method, if you return a Response, that response will be used and the request
|
||||
won't be processed any further down the stack.
|
||||
|
||||
WARNING: Be very careful about using this signal as listening to it makes it really
|
||||
easy to cause serious performance problems.
|
||||
|
||||
As with all plugin signals, the ``sender`` keyword argument will contain the event.
|
||||
"""
|
||||
|
||||
@@ -9,6 +9,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
from pretix.base.middleware import LocaleMiddleware
|
||||
from pretix.base.models import Event, EventPermission, Organizer
|
||||
from pretix.multidomain.urlreverse import get_domain
|
||||
from pretix.presale.signals import process_request
|
||||
|
||||
|
||||
def _detect_event(request):
|
||||
@@ -63,6 +64,10 @@ def _detect_event(request):
|
||||
event=request.event, user=request.user).exists():
|
||||
raise PermissionDenied(_('The selected ticket shop is currently not available.'))
|
||||
|
||||
for receiver, response in process_request.send(request.event, request=request):
|
||||
if response:
|
||||
return response
|
||||
|
||||
except Event.DoesNotExist:
|
||||
raise Http404(_('The selected event was not found.'))
|
||||
except Organizer.DoesNotExist:
|
||||
|
||||
Reference in New Issue
Block a user