source: TI01-discovery-OaiInfoEditor/trunk/v3n_NDG3/OAIInfoEditor/oai_info_editor/controllers/home.py @ 6758

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI01-discovery-OaiInfoEditor/trunk/v3n_NDG3/OAIInfoEditor/oai_info_editor/controllers/home.py@6758
Revision 6758, 1.6 KB checked in by sdonegan, 11 years ago (diff)

Added new controller for displaying error page for login problems

  • Property svn:executable set to *
Line 
1'''
2 Class representing pylons controller to create the home page for the OAI Info Editor
3 
4 @author: C Byrom, Tessella Apr 2009
5'''
6import logging, urllib
7from oai_info_editor.lib.base import *
8from oai_info_editor.lib.constants import *
9from oai_info_editor.controllers.master import MasterController
10from oai_info_editor.controllers.master import ADMIN_PARAMETER
11
12class HomeController(MasterController):
13
14    def index(self):
15        logging.info("Rendering editor home page")
16        c.title = EDITOR_HOME_TITLE
17        self._setUpController()
18       
19        if session.get(POP_UP_MESSAGE_SESSION_KEY):
20            c.popupMessage = session.get(POP_UP_MESSAGE_SESSION_KEY)
21            del session[POP_UP_MESSAGE_SESSION_KEY]
22            session.save()
23       
24        if c.user.isAdmin:
25            c.createLink = h.url_for('createProviderInfo') + ADMIN_PARAMETER
26       
27        return self._renderTemplate('genshi', 'home')
28
29   
30   
31    def showHelpPage(self):
32        '''
33        Show the help page
34        '''
35        logging.info("Rendering help page")
36        self._setUpController()
37        c.title = HELP_PAGE_TITLE
38        return self._renderTemplate('genshi', 'oai_info_editor_help')
39       
40   
41   
42    def loginDeniedPage(self):
43        '''
44        Show a specialised error page if user tries to do anything but doesnt have the correct openId roles etc etc
45        '''
46        logging.info("Rendering login denied page")
47       
48        self._setUpController()
49       
50        c.title = "Hi there Steve - this is a user login denied page"
51       
52        return self._renderTemplate('genshi', 'loginDenied')
53   
Note: See TracBrowser for help on using the repository browser.