Changeset 2674


Ignore:
Timestamp:
29/06/07 16:49:06 (12 years ago)
Author:
domlowe
Message:

integrating Bryan s code, NOTE have changed login httpredirect -added try except- and have also made the passwordFile path to be a relative path in the ndgDiscovery config file

Location:
TI05-delivery/ows_framework/trunk/ows_server/ows_server
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/config/ndgDiscovery.config

    r2672 r2674  
    1111# the following is the server on which this browse/discovery instance runs! 
    1212server:         http://localhost:8080 
    13 passwordFile:   /home/bnl/sandboxes/ndg/TI05-delivery/ows_framework/trunk/ows_server/ows_server/config/passwords.txt 
     13passwordFile:   ./ows_server/config/passwords.txt 
     14#/home/bnl/sandboxes/ndg/TI05-delivery/ows_framework/trunk/ows_server/ows_server/config/passwords.txt 
    1415# 
    1516# the following is the server on which the NDG discovery service is running! (Not to be confused with 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/config/routing.py

    r2650 r2674  
    3131     
    3232    map.connect(':file/wms', controller='csml_wms') 
     33    map.connect('wcs/:fileoruri', controller='csml_wcs') 
    3334    map.connect(':file/wcs', controller='csml_wcs') 
    3435    map.connect(':file/status/:jobID', controller='status', action='getStatus') 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/controllers/csml_api.py

    r2529 r2674  
    1111from ows_server.lib.base import * 
    1212import os 
    13 from ows_server.lib.csml_util import get_csml_doc, CsmlBundle 
     13from ows_server.lib.csml_util import get_csml_doc, CsmlBundle, get_csml_document 
    1414from elementtree import ElementTree as ET 
    1515 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/controllers/csml_wcs.py

    r2670 r2674  
    1010 
    1111#NOTE, much of this is straight from WMS and needs to be overhauled. 
    12 import os, string, StringIO 
     12import os, time, string, StringIO 
    1313 
    1414from ows_server.lib.base import * 
    15 from ows_server.controllers.csml_api import get_csml_doc 
    1615from ows_server.lib.decorators import * 
    1716import ows_server.lib.validators as V 
     
    3231 
    3332from ows_server.controllers.status import StatusController 
    34 import time 
    35  
     33from ows_server.models import ndgObject,ndgRetrieve 
     34from ows_server.controllers.retrieve import RetrieveController 
    3635 
    3736class CsmlWcsController(OwsController): 
     
    4039        'ExceptionFormat': make_domain(['text/xml']), 
    4140        } 
     41 
     42    def _get_csml_document(self,fileoruri): 
     43        """ 
     44        Gets a csml document from file or exist when passed a file name or uri - this should make 'get_csml_doc' obselete 
     45        """ 
     46        if string.find(fileoruri,'__NDG-A0__') == -1: 
     47            #it's a local file not an identifier 
     48            file=fileoruri 
     49            csml_dir = request.environ['paste.config']['app_conf']['csml_dir'] 
     50            path = os.path.join(csml_dir, file) 
     51            if os.path.exists(path+'.csml'): 
     52                f = path+'.csml' 
     53            elif os.path.exists(path+'.xml'): 
     54                f = path +'.xml' 
     55            else: 
     56                raise ValueError("Cannot find CSML file %s" % file) 
     57             
     58            d = csml.parser.Dataset() 
     59            d.parse(f) 
     60         
     61        else: 
     62            #it's an NDG identifier, get the document from exist. 
     63            uri=fileoruri 
     64            uri='badc.nerc.ac.uk__NDG-A0__ReMryRVA'         
     65            uriN=ndgObject.ndgObject(uri) 
     66            self.cf=request.environ['ndgConfig'] 
     67            self.requestor=request.environ['REMOTE_ADDR'] 
     68            print 'session',session 
     69            if 'ndgSec' in session: 
     70                securityTokens=session['ndgSec'] 
     71            else: securityTokens=None 
     72            print securityTokens 
     73            status,x=ndgRetrieve.ndgRetrieve( 
     74                    uriN,self.cf,requestor=self.requestor, 
     75                    securityTokens=securityTokens) 
     76            print 'output from retrieve controller: ',x         
     77            print type(x) 
     78            #TODO, need to parse this output into a csml Dataset object, d 
     79             
     80        return d 
     81 
     82 
    4283 
    4384    def _createMultipartMime(self, xml, netcdf): 
     
    124165    @parameter('Service', possibleValues=['WCS'], required=True) 
    125166    @parameter('Version', possibleValues=['1.1.0']) 
    126     def GetCapabilities(self, file, service=None, version=None): 
     167    def GetCapabilities(self, fileoruri, service=None, version=None): 
    127168        """ 
    128169        @note: format and updatesequence parameters are not supported 
     
    131172        """ 
    132173        # Populate the context object with information required by the template 
    133         #c.dataset = get_csml_doc(file) 
     174        c.dataset = self._get_csml_document(fileoruri) 
     175         
    134176        #get doc from cache or disk: 
    135         c.dataset = csmlCache[file] 
     177        #c.dataset = csmlCache[fileoruri] 
    136178        return self._renderCapabilities('ows/wcs_capabilities') 
    137179 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/controllers/login.py

    r2672 r2674  
    2222        session['panelView']='History' 
    2323        session.save() 
    24          
    2524        # and now go back to whence we had come 
    26         h.redirect_to(c.returnTo) 
     25        try: 
     26            h.redirect_to(c.returnTo) 
     27        except: 
     28            #Dom added this try except as the http redirect was failing if controller accessed directly e.g. through http://localhost:8080/login 
     29            return 'Logged in' 
    2730         
    2831    def wayf(self): 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/controllers/retrieve.py

    r2672 r2674  
    4444            return Response(xml) 
    4545        else: 
    46             return Response(xml) 
     46            return Response(x)  
    4747         
    4848    def view(self,uri): 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/lib/csml_util.py

    r2667 r2674  
    99""" 
    1010from pylons import Response, c, g, cache, request, session 
    11  
    1211import csml, cdms 
    1312import os 
    1413import zipfile 
    1514import tempfile 
     15 
    1616 
    1717 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/lib/decorators.py

    r2578 r2674  
    3939        could detect POST and support XML encoding. 
    4040 
    41         @param mself: The object of the method being called. 
     41        @param self: The object of the method being called. 
    4242        @param kw: All other keyword arguments are passed to the method. 
    4343         
Note: See TracChangeset for help on using the changeset viewer.