source: TI07-MOLES/trunk/PythonCode/wsgi/ndgBrowse.py @ 1903

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

This is the shell of a new (and complete) rewrite of discovery
and browse as wsgi applications. (Discovery is already partially
rewritten in this manner, but handling browse will be more
difficult).

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