From e20ecb67d84cf414b6b37e1fc6041029bc0f8ff4 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Mon, 16 Mar 2015 01:31:52 +0100 Subject: [PATCH] Add a request argument to the html_head signals --- doc/development/api/general.rst | 3 ++- src/pretix/control/context.py | 2 +- src/pretix/control/signals.py | 2 +- src/pretix/presale/context.py | 2 +- src/pretix/presale/signals.py | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/development/api/general.rst b/doc/development/api/general.rst index e5cc84710..935c7c9e5 100644 --- a/doc/development/api/general.rst +++ b/doc/development/api/general.rst @@ -12,7 +12,8 @@ HTML head injection These two signals allow you to put code inside the HTML ```` tag of every page. One signal is for the frontend, one for the backend. You -won't get any arguments and can return plain HTML. +will get the request as a keyword argument ``request`` and can return plain +HTML. * ``pretix.presale.signals.html_head`` * ``pretix.control.signals.html_head`` \ No newline at end of file diff --git a/src/pretix/control/context.py b/src/pretix/control/context.py index d318b56fe..9cc66d5e6 100644 --- a/src/pretix/control/context.py +++ b/src/pretix/control/context.py @@ -16,7 +16,7 @@ def contextprocessor(request): } _html_head = [] if hasattr(request, 'event'): - for receiver, response in html_head.send(request.event): + for receiver, response in html_head.send(request.event, request=request): _html_head.append(response) ctx['html_head'] = "".join(_html_head) diff --git a/src/pretix/control/signals.py b/src/pretix/control/signals.py index a44ce0192..af6c9d102 100644 --- a/src/pretix/control/signals.py +++ b/src/pretix/control/signals.py @@ -13,5 +13,5 @@ restriction_formset = EventPluginSignal( This signal is sent out to include code into the HTML tag """ html_head = EventPluginSignal( - providing_args=[] + providing_args=["request"] ) diff --git a/src/pretix/presale/context.py b/src/pretix/presale/context.py index 8f1883a06..a54e9b742 100644 --- a/src/pretix/presale/context.py +++ b/src/pretix/presale/context.py @@ -14,7 +14,7 @@ def contextprocessor(request): } _html_head = [] if hasattr(request, 'event'): - for receiver, response in html_head.send(request.event): + for receiver, response in html_head.send(request.event, request=request): _html_head.append(response) ctx['html_head'] = "".join(_html_head) diff --git a/src/pretix/presale/signals.py b/src/pretix/presale/signals.py index 621100b2d..aa760970c 100644 --- a/src/pretix/presale/signals.py +++ b/src/pretix/presale/signals.py @@ -5,5 +5,5 @@ from pretix.base.signals import EventPluginSignal This signal is sent out to include code into the HTML tag """ html_head = EventPluginSignal( - providing_args=[] + providing_args=["request"] )