source: TI07-MOLES/trunk/PythonCode/wsgi/renderService.py @ 1958

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI07-MOLES/trunk/PythonCode/wsgi/renderService.py@1958
Revision 1958, 604 bytes checked in by lawrence, 14 years ago (diff)

Refactoring discovery wsgi for cleaner service binding. (Done, but
there will be implications for wsgi browse which may now be broken,
but I can't test it til the database is updated).

Line 
1class renderService:
2    def __init__(self,config):
3        self.config=config
4    def get(self,service):
5        if service.contentType not in ['NDG_A_Service','NDG_B_Service','DISCOVERY']:
6            section='RELATED'
7        else: section=service.contentType
8        icon=self.config.get(section,'icon')
9        alt=self.config.get(section,'icon_alt')
10        if service.description=='':
11            d=self.config.get(section,'title')
12        else: d=service.description
13        return '<a href="%s" title="%s"><img src="%s" alt="%s"/></a>'%(
14                service.url,service.description,icon,alt)
Note: See TracBrowser for help on using the repository browser.