PageRenderTime 82ms CodeModel.GetById 50ms app.highlight 16ms RepoModel.GetById 14ms app.codeStats 0ms

/tests/regressiontests/context_processors/views.py

https://code.google.com/p/mango-py/
Python | 37 lines | 28 code | 8 blank | 1 comment | 0 complexity | fe23deaeb1d30c7129448996e804a830 MD5 | raw file
 1from django.core import context_processors
 2from django.shortcuts import render_to_response
 3from django.template.context import RequestContext
 4
 5
 6def request_processor(request):
 7    return render_to_response('context_processors/request_attrs.html',
 8        RequestContext(request, {}, processors=[context_processors.request]))
 9
10def auth_processor_no_attr_access(request):
11    r1 = render_to_response('context_processors/auth_attrs_no_access.html',
12        RequestContext(request, {}, processors=[context_processors.auth]))
13    # *After* rendering, we check whether the session was accessed
14    return render_to_response('context_processors/auth_attrs_test_access.html',
15        {'session_accessed':request.session.accessed})
16
17def auth_processor_attr_access(request):
18    r1 = render_to_response('context_processors/auth_attrs_access.html',
19        RequestContext(request, {}, processors=[context_processors.auth]))
20    return render_to_response('context_processors/auth_attrs_test_access.html',
21        {'session_accessed':request.session.accessed})
22
23def auth_processor_user(request):
24    return render_to_response('context_processors/auth_attrs_user.html',
25        RequestContext(request, {}, processors=[context_processors.auth]))
26
27def auth_processor_perms(request):
28    return render_to_response('context_processors/auth_attrs_perms.html',
29        RequestContext(request, {}, processors=[context_processors.auth]))
30
31def auth_processor_messages(request):
32    request.user.message_set.create(message="Message 1")
33    return render_to_response('context_processors/auth_attrs_messages.html',
34         RequestContext(request, {}, processors=[context_processors.auth]))
35
36def userpage(request):
37    pass