From 2973ec1f33ac78f1d03f2ca8a80b318e0abf161d Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Sat, 10 Sep 2011 00:16:39 +0200 Subject: [PATCH] set cookie in @template decorator if the dict has the value cookie, set a cookie with dict['cookie'][0] as Name and ['cookie'][1] as value --- openslides/utils/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openslides/utils/utils.py b/openslides/utils/utils.py index bb7450d21..52a76838d 100644 --- a/openslides/utils/utils.py +++ b/openslides/utils/utils.py @@ -49,7 +49,10 @@ def template(template_name): output = func(request, *args, **kw) if not isinstance(output, dict): return output - return render_to_response(template_name, output, context_instance=RequestContext(request)) + response = render_to_response(template_name, output, context_instance=RequestContext(request)) + if 'cookie' in output: + response.set_cookie(output['cookie'][0], output['cookie'][1]) + return response return wrapper return renderer