source: TI05-delivery/ows_framework/trunk/ows_server/ows_server/config/ndgMiddleware.py @ 3120

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI05-delivery/ows_framework/trunk/ows_server/ows_server/config/ndgMiddleware.py@3120
Revision 3120, 2.6 KB checked in by lawrence, 12 years ago (diff)

Oops, fix to actually respect the config file value of standalone true or false

Line 
1# ndg middleware
2from paste.deploy import CONFIG
3from ows_server.models.Utilities import myConfig
4from ows_server.lib.security_util import SecurityConfig
5
6class ndgMiddleware:
7   
8    def __init__(self,app,g):
9       
10        #this is the next application in the wsgi stack
11        self.app=app
12       
13        #set up the ndg configuration file
14       
15        #Changed by Dom: CONFIG.get wasn't respecting the %(home)s variable, so moved to app_conf section in ini file.
16        #cf=CONFIG.get('configfile')
17        cf= CONFIG['app_conf']['configfile']
18        cf=myConfig(cf)
19     
20        self.globals=g
21        self.globals.localLink=cf.get('layout','localLink',None)
22        self.globals.localImage=cf.get('layout','localImage',None)
23        self.globals.localAlt=cf.get('layout','localAlt','Visit Local Site')
24        self.globals.ndgLink=cf.get('layout','ndgLink','http://ndg.nerc.ac.uk')
25        self.globals.ndgImage=cf.get('layout','ndgImage',None)
26        self.globals.ndgAlt=cf.get('layout','ndgAlt','Visit NDG')
27        self.globals.stfcLink=cf.get('layout','stfcLink')
28        self.globals.stfcImage=cf.get('layout','stfcImage')
29        self.globals.helpIcon=cf.get('layout','helpIcon')
30        self.globals.LeftAlt=cf.get('layout','HdrLeftAlt')
31        self.globals.LeftLogo=cf.get('layout','HdrLeftLogo')
32        self.globals.pageLogo="bodcHdr"
33        self.globals.icons_xml=cf.get('layout','Xicon')
34        self.globals.icons_prn=cf.get('layout','printer')
35        self.globals.icons_A=cf.get('NDG_A_SERVICE','icon')
36        self.globals.icons_B=cf.get('NDG_B_SERVICE','icon')
37        self.globals.icons_D=cf.get('DISCOVERY','icon')
38        self.globals.icons_R=cf.get('RELATED','icon')
39        self.globals.icons_key=cf.get('layout','key')
40       
41        self.globals.disclaimer=cf.get('default','disclaimer')
42       
43        self.globals.discoveryURL=cf.get('SEARCH','discoveryURL')
44       
45        self.globals.server=cf.get('DEFAULT','server','')
46
47        # Security Related
48        self.globals.wayfuri='%s/wayf'%self.globals.server
49
50        # Use secure connection
51        self.globals.sslServer=cf.get('NDG_SECURITY','sslServer','')
52        self.globals.getCredentials='%s/getCredentials'%self.globals.sslServer       
53        self.globals.logout='%s/logout'%self.globals.server
54        self.globals.securityCfg = SecurityConfig(cf)
55       
56        # for standalone discovery
57        standalone={'True':1,'False':0}[cf.get('DISCOVERY','standalone')]
58        self.globals.standalone= standalone
59         
60       
61        self.config=cf
62       
63       
64    def __call__(self,environ,start_response):
65       
66        environ['ndgConfig']=self.config
67        return self.app(environ,start_response)
68   
Note: See TracBrowser for help on using the repository browser.