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
This commit is contained in:
parent
2fe4a0ce29
commit
2973ec1f33
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user