Changeset 2694
- Timestamp:
- 03/07/07 17:00:31 (14 years ago)
- Location:
- TI05-delivery/ows_framework/trunk/ows_server/ows_server
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
TI05-delivery/ows_framework/trunk/ows_server/ows_server/controllers/login.py
r2676 r2694 24 24 # and now go back to whence we had come 25 25 if c.returnTo!='': 26 # is there a keyword on redirect_to that can make this https? See: 27 # http://pylonshq.com/project/pylonshq/browser/Pylons/trunk/pylons/decorators/secure.py#L69 26 28 h.redirect_to(c.returnTo) 27 29 else: -
TI05-delivery/ows_framework/trunk/ows_server/ows_server/controllers/retrieve.py
r2688 r2694 1 1 2 2 from ows_server.lib.base import * 3 from ows_server.models import ndgObject, ndgRetrieve,Utilities3 from ows_server.models import ndgObject, Utilities 4 4 from paste.request import parse_querystring 5 5 from ows_server.models import stubB,DIF 6 6 from ows_server.lib import mailer 7 7 from ows_server.lib.ndgInterface import interface 8 8 from xml.parsers.expat import ExpatError 9 9 #from ows_server.models import ndgRetrieve … … 39 39 c.xml='<p>%s</p>'%status 40 40 return render_response('error') 41 status,x=ndgRetrieve.ndgRetrieve( 42 self.uri,self.cf,logger=self.logger,requestor=self.requestor,format=self.format) 41 status,x=interface(self.uri,self.cf,logger=self.logger,format=self.format) 43 42 44 43 if status: … … 57 56 c.xml='<p>%s</p>'%status 58 57 return render_response('error') 59 if 'ndgSec' in session: 60 securityTokens=session['ndgSec'] 61 else: securityTokens=None 62 63 status,x=ndgRetrieve.ndgRetrieve( 64 self.uri,self.cf,logger=self.logger,requestor=self.requestor,format=self.format, 65 securityTokens=securityTokens) 58 status,x=interface.GetXML(uri) 66 59 c.title='Viewing [%s]'%self.uri 67 60 68 69 61 if status: 70 62 #(the return object x is an xmlHandler object) -
TI05-delivery/ows_framework/trunk/ows_server/ows_server/lib/base.py
r2678 r2694 24 24 25 25 class BaseController(WSGIController): 26 26 27 def __call__(self, environ, start_response): 27 28 # Insert any code to be run per request here. The Routes match -
TI05-delivery/ows_framework/trunk/ows_server/ows_server/models/ndgRetrieve.py
r2655 r2694 2 2 import cgi,time 3 3 from Utilities import myConfig 4 from ndgSecurity import HandleSecurity 4 5 5 6 6 debug=0 7 def ndgRetrieve(uri,config,logger=0, requestor='test',format='',securityTokens=None):7 def ndgRetrieve(uri,config,logger=0,format=''): 8 8 9 9 ''' Given an ndgObject, uri, retrieve it, with security in place ''' … … 38 38 status,ws=getws(config,uri) 39 39 if not status: return status,ws 40 try:41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 logString='Document retrieve [%s] for [%s] took [%ss]'%(uri,requestor,time2)61 40 #try: 41 if uri.schema=='NDG-A0': 42 target='/db/ndg_A_metadata' 43 elif uri.schema=='NumSim': 44 target='/db/NumSim' 45 else: 46 target='/db/ndg_B_metadata' 47 if format=='': format=uri.schema 48 #do the actual search: 49 time1=time.time() 50 print uri.uri 51 if debug: 52 if uri.uri in ['badc.nerc.ac.uk__NDG-B1__dataent_COAPEC', 53 'badc.nerc.ac.uk__NumSim__HiGEM_6.1_CodeBase', 54 'badc.nerc.ac.uk__NumSim__HiGEM_6.1_Control']: 55 f=str('ows_server/examples/%s.xml'%uri.uri) 56 r=file(f,'r').read() 57 else: 58 r=ws.get(uri.repository,uri.schema,uri.localID,format=format,targetCollection=target) 59 time2=time.time()-time1 60 logString='Document retrieve [%s] took [%s]'%(uri,time2) 61 if logger: logger.info(logString) 62 62 63 64 65 66 67 except Exception,e:68 return 0,'<p> Unable to retrieve [%s], reason was [%s]</p>'%(uri,cgi.escape(str(e)))63 # did we get a sensible answer? 64 if isinstance(r,int): 65 return 0,'<p> There are %s identifiers matching your request! </p>'%r 66 67 #except Exception,e: 68 # return 0,'<p> Unable to retrieve [%s], reason was [%s]</p>'%(uri,cgi.escape(str(e))) 69 69 70 70 #temporary hack for empty docs from non-existent DIFs ... … … 74 74 75 75 x=xmlHandler2.xmlHandler(r,string=1) 76 if uri.schema=='DIF': 77 pass # no access control 78 elif uri.schema =='NDG-B0': 79 #cred=x.find('dgSecurityCondition/simpleCondition') 80 #if cred: 81 # return 0,'<p> Access Control: <br/>[<![CDAT[%s]]> </p>' 82 pass 83 elif uri.schema =='NDG-B1': 84 pass 85 elif uri.schema =='NDG-A0': 86 87 s=x.tree.find('{http://ndg.nerc.ac.uk/csml}AccessControlPolicy/{http://ndg.nerc.ac.uk/csml}dgSecurityCondition') 88 if s is not None: 89 status,message=HandleSecurity(s,securityTokens) 90 if not status: return 0,'<p> Access Denied </p><p>%s</p>'%message 76 91 77 return 1,x 92 78 … … 155 141 status,xml=ndgRetrieve(uri,self.c) 156 142 if status: s=str(xml) 157 158 159 def testSecurityCSML(self): 160 ''' Make sure that CSML security is respected ''' 161 securityTokens=None 162 self.setup() 163 doc='badc.nerc.ac.uk__NDG-A0__AfEj15o6' 164 uri=ndgObject.ndgObject(doc) 165 status,xml=ndgRetrieve(uri,self.c) 166 self.assertEqual(status,0) 143 167 144 168 145 -
TI05-delivery/ows_framework/trunk/ows_server/ows_server/models/stubB.py
r2688 r2694 75 75 76 76 class ObservationStation: 77 def __init__(self, e):77 def __init__(self,h,e): 78 78 self.e=e 79 79 if e is None: return 80 80 class DataProductionTool: 81 def __init__(self, e):81 def __init__(self,h,e): 82 82 self.e=e 83 83 if e is None: return 84 84 class Activity: 85 def __init__(self, e):85 def __init__(self,h,e): 86 86 self.e=e 87 87 if e is None: return … … 182 182 self.citation='' 183 183 self.personnel=[] # for DIF compatiability for the moment. 184 self.parameters=None 185 self.granules=[] 184 186 185 187 try: … … 210 212 DataEntity.__init__(self,helper,elem) 211 213 elif elem.tag=='dgActivity': 212 pass214 Activity.__init__(self,helper,elem) 213 215 elif elem.tag=='dgDataProductionTool': 214 pass216 DataProductionTool.__init__(self,helper,elem) 215 217 elif elem.tag=='dgObservationStation': 216 pass218 ObservationStation.__init__(self,helper,elem) 217 219 218 220 self.description=dgMetadataDescription(helper,helper.find(self.tree,'dgMetadataDescription')) -
TI05-delivery/ows_framework/trunk/ows_server/ows_server/public/js/OLMapBox.js
r2688 r2694 12 12 initialize: function(div, formDiv, selFormDiv, controlUri) { 13 13 this.control = controlUri // Yadayada yada ... I dunno what i'm doing 14 this.control.onchange = this.updateDdcLayer.bindAsEventListener(this);14 //this.control.onchange = this.updateDdcLayer.bindAsEventListener(this); 15 15 16 16 this.selFormDiv = $(selFormDiv); -
TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/meta.kid
r2688 r2694 5 5 6 6 <div py:def="ParameterList(params)" class="ParameterList"> 7 <table cellspacing="0" cellpadding="3" border="0" width="100%"><tbody>7 <table py:if="params is not None" cellspacing="0" cellpadding="3" border="0" width="100%"><tbody> 8 8 <tr><td class="linehead"><span class="heading0"> Parameters</span></td></tr> 9 9 <span py:for="item in params">
Note: See TracChangeset
for help on using the changeset viewer.