Ignore:
Timestamp:
31/08/07 10:58:53 (12 years ago)
Author:
spascoe
Message:

Added a config. option to send OWS exceptions to the pylons debugger.
This makes debugging OWS servers much easier.

A couple of tweeks to the WMS controller to make it work from eXist.

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

Legend:

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

    r2860 r2861  
    171171formatDefault=DIF 
    172172icon_title: Links to the DISCOVERY RECORD for this dataset 
     173 
     174[OWS_SERVER] 
     175# 
     176# Configure the OWS_SERVER framework here 
     177# 
     178 
     179# exception_type: whether OGC servers should send a valid ExceptionReport on errors 
     180#     or use pylon's debugger.  Very useful for debugging OWS controllers.  Default is ogc 
     181#exception_type: ogc 
     182#exception_type: pylons 
     183 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/controllers/csml_wcs.py

    r2850 r2861  
    166166            rstatus,c.dataset=interface.GetParsedCSML(uri)                 
    167167            if not rstatus:  
    168                 c.xml='<div class="error">%s</div>'%dataset 
     168                c.xml='<div class="error">%s</div>'%c.dataset 
    169169                resp=render_response('error') 
    170170                return resp 
     
    184184                    raise OWS_E.NoApplicableCode(e) 
    185185            else: 
    186                raise OWS_E.NoApplicableCode(e) 
    187              
     186                raise OWS_E.NoApplicableCode(e) 
    188187             
    189188    @operation 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/controllers/csml_wms.py

    r2693 r2861  
    1414from ows_server.lib.csml_cache import csmlCache, extractCache 
    1515import ows_server.lib.validators as V 
     16from ows_server.lib.ndgInterface import interface 
    1617 
    1718from elementtree import ElementTree as ET 
     
    102103    @parameter('Service', possibleValues=['WMS'], required=True) 
    103104    @parameter('Version', possibleValues=['1.3.0']) 
    104     def GetCapabilities(self, file, service=None, version=None): 
     105    def GetCapabilities(self, uri, service=None, version=None): 
    105106        """ 
    106107        @note: format and updatesequence parameters are not supported 
     
    108109 
    109110        """ 
    110         # Populate the context object with information required by the template 
    111         c.dataset = csmlCache[file] 
     111        # Retrieve dataset and selected feature 
     112        rstatus, c.dataset = interface.GetParsedCSML(uri) 
     113 
     114        if not rstatus: 
     115            c.xml='<div class="error">%s</div>' % dataset 
     116            resp = render_response('error') 
     117            return resp 
    112118 
    113119        return self._renderCapabilities('ows/wms_capabilities') 
     
    127133    @parameter('Exceptions') 
    128134    # Dimension parameters Time, Elevation, etc. are handled separately 
    129     def GetMap(self, file, version, layers, styles, crs, bbox, width, height, format, 
     135    def GetMap(self, uri, version, layers, styles, crs, bbox, width, height, format, 
    130136               transparent=False, bgcolor=None, exceptions=None): 
    131137 
    132138        # Retrieve dataset and selected feature 
    133         dataset = csmlCache[file] 
     139        rstatus, dataset = interface.GetParsedCSML(uri) 
     140        if not rstatus: 
     141            c.xml='<div class="error">%s</div>' % dataset 
     142            resp = render_response('error') 
     143            return resp 
     144             
     145        # Retrieve feature from the layers parameter 
    134146        feature = dataset.getFeature(layers) 
    135147        if feature is None: 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/lib/base.py

    r2854 r2861  
    2222import logging 
    2323logger = logging.getLogger('ows_server.lib.base') 
     24 
     25# Configure 
     26EXCEPTION_TYPE = request.environ['ndgConfig'].get('OWS_SERVER', 'exception_type', 'ogc').lower() 
     27 
     28 
    2429 
    2530class BaseController(WSGIController): 
     
    6671            self.ows_params[k.lower()] = req.params[k]         
    6772 
    68         try: 
     73        # If the EXCEPTION_TYPE is 'pylons' let Pylons catch any exceptions. 
     74        # Otherwise send an OGC exception report for any OWS_E.OwsError 
     75        if 'pylons' in EXCEPTION_TYPE: 
    6976            self._fixOwsAction(environ) 
    7077            return super(OwsController, self).__call__(environ, start_response) 
    71         except OWS_E.OwsError, e: 
    72             logger.exception(e) 
    73             r=render_response('exception_report', report=e.report, format='xml') 
    74             r.headers['content-type'] = 'text/xml' 
    75             return r 
     78        else: 
     79            try: 
     80                self._fixOwsAction(environ) 
     81                return super(OwsController, self).__call__(environ, start_response) 
     82            except OWS_E.OwsError, e: 
     83                logger.exception(e) 
     84 
     85                r=render_response('exception_report', report=e.report, format='xml') 
     86                r.headers['content-type'] = 'text/xml' 
     87                return r 
    7688             
    7789  
Note: See TracChangeset for help on using the changeset viewer.