source: mauRepo/dj_security/trunk/dj_security/views/__init__.py @ 8791

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/dj_security/trunk/dj_security/views/__init__.py@8791
Revision 8791, 1.1 KB checked in by mnagni, 7 years ago (diff)

Incomplete - # 22737: [CEDA Site Python Port] Resource Registration - Make Agreement Docs PDFs
 http://team.ceda.ac.uk/trac/ceda/ticket/22737
Incomplete - # 22802: [CEDA Site Python Port] Login - no message is displayed when the user enters the wrong password
 http://team.ceda.ac.uk/trac/ceda/ticket/22802

Implements the "Reset Password" functionality

  • Property svn:mime-type set to text/plain
Line 
1from django.core.context_processors import csrf
2from django.template.context import RequestContext
3from django.shortcuts import render_to_response
4
5def mm_render_to_response(request, context, page_to_render):
6    """
7    Exploits a 'render_to_response' action. The advantage of this method
8    is to contains a number of operations that are expected to be  called
9    for each page rendering, for example passing the application version number
10     
11    **Parameters**           
12        * HttpRequest_ **request**
13            a django HttpRequest instance       
14        * `dict` **context**
15            a dictionary where to pass parameter to the rendering function   
16        * `string` **page_to_render**
17            the html page to render                         
18    """
19    if context is None or not isinstance(context, dict):
20        raise Exception("Cannot render an empty context")
21   
22    #context['version'] = assemble_version()
23    context.update(csrf(request))
24    rcontext = RequestContext(request, context)
25    return render_to_response(page_to_render, rcontext)
Note: See TracBrowser for help on using the repository browser.