source: TI07-MOLES/trunk/PythonCode/wsgi/ndgDiscovery.py @ 1955

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI07-MOLES/trunk/PythonCode/wsgi/ndgDiscovery.py@1955
Revision 1955, 1.3 KB checked in by lawrence, 13 years ago (diff)

More improvements to wsgi discovery, some unit tests, improved
namespace handling in DIF.py ...

Line 
1from Utilities import myConfig
2
3from DiscoveryGUI import DiscoveryGUI
4
5def discoveryFactory(global_config,**local_conf):
6   
7    ''' This factory is intended to be used by paste-deploy to return
8    the ndgDiscovery wsgi application, configured to use the configDir
9    to find local configuration information '''
10   
11    if 'configDir' in local_conf.keys():
12        configDir=local_conf[configDir]
13    else:
14        try:
15            configDir=global_config['configDir']
16        except:
17            configDir=None
18    ndg=ndgDiscovery(configDir)
19    return ndg
20
21         
22class ndgDiscovery:
23   
24    ''' This is the ndgDiscovery GUI application, which also provides the
25    RESTful interface to ndgDiscovery '''
26   
27    def __init__(self,configDir):
28       
29        ''' Instantiate a wsgi ndgDiscovery GUI application '''
30        self.configDir=configDir
31        self.config=myConfig(configDir+'ndgDiscovery.config')
32        self.logger=self.config.getLog()
33   
34    def __call__(self,environ,start_response):
35       
36        ''' This is the wsgi function which implements the ndgDiscovery '''
37       
38        d=DiscoveryGUI(environ,self.config,self.logger)
39
40        start_response('200 OK', [('Content-Type', 'text/html')])
41        #h='<p>%s:%s</p>'%(str(inputs),self.config.get('SEARCH','advancedURL'))
42       
43        return [d.html]
Note: See TracBrowser for help on using the repository browser.