source: TI01-discovery/branches/ingestAutomation-upgrade/OAIBatch/renderService.py @ 3800

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI01-discovery/branches/ingestAutomation-upgrade/OAIBatch/renderService.py@3800
Revision 3800, 621 bytes checked in by cbyrom, 11 years ago (diff)

Upgraded version of ingest codebranch - including major refactoring of the ingest
scripts to make more OO - allowing re-use and simplification of code + removal of reliance
on eXist DB to store data; this will now all be stored and looked up from the Postgres DB

Line 
1class renderService:
2    def __init__(self,config):
3        self.config=config
4    def __call__(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        yield '<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.