source: TI01-discovery/trunk/OAIInfoEditor/oai_info_editor/controllers/view.py @ 5237

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI01-discovery/trunk/OAIInfoEditor/oai_info_editor/controllers/view.py@5237
Revision 5237, 1.5 KB checked in by cbyrom, 11 years ago (diff)

Various tidy ups of editor code - including restricting editing rights
to non-admin users of editor.

  • Property svn:executable set to *
Line 
1'''
2 Class representing pylons controller for the viewing of provider info by users to
3 update/create new Provider Info
4 
5 @author: C Byrom, Tessella Apr 2009
6'''
7import logging, urllib
8from oai_info_editor.lib.base import *
9from oai_info_editor.controllers.master import MasterController
10import oai_info_editor.lib.constants as const
11
12class ViewController(MasterController):
13
14    def viewProviderInfo(self, providerName):
15        '''
16        View the provider info associated with the input name
17        @param providerName: name of provider whose info should be displayed
18        '''
19        providerName = urllib.unquote(providerName)
20        self._setUpController(providerName = providerName)
21        logging.info("Setting up page to display info for provider, '%s'" %providerName)
22
23        if not c.providerInfos:
24            raise ValueError("Unrecognised provider name, '%s'" %providerName)
25       
26        c.title = const.VIEW_PAGE_TITLE %providerName
27        if providerName == const.ALL_PROVIDER_IDS:
28            c.title = const.VIEW_ALL_DATA_TITLE
29                   
30        c.editLink = h.url_for('editProviderInfo', providerName = '')
31        if c.user.isAdmin:
32            c.createLink = h.url_for('createProviderInfo')
33            # NB, these links are provider dependent and we can display several
34            # provider's data in a page - so finish constructing the links in the
35            # templates
36            c.deleteLink = h.url_for('deleteProviderInfo', providerName = '')
37       
38        return self._renderTemplate('genshi', 'view_provider_infos')
39
Note: See TracBrowser for help on using the repository browser.