Ignore:
Timestamp:
29/02/08 13:58:46 (12 years ago)
Author:
spascoe
Message:

Added a simple data interface for WMS. This may not live in ows_common
in the long term but is the most convenient place to put it for now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI05-delivery/ows_framework/branches/ows_framework-refactor/ows_common/ows_common/pylons/ows_controller.py

    r3496 r3548  
    3232 
    3333# Instantiate Genshi template loader 
    34 genshiLoader = TemplateLoader( 
     34templateLoader = TemplateLoader( 
    3535    resource_filename('ows_common.pylons', 'templates'), 
    3636    auto_reload=True, 
     
    4444 
    4545 
    46 class OwsControllerBase(WSGIController): 
     46class OWSControllerBase(WSGIController): 
    4747    """ 
    4848    @ivar owsParams: A dictionary of parameters passed to the service. 
     
    6363        if 'pylons' in EXCEPTION_TYPE: 
    6464            self._fixOwsAction(environ) 
    65             return super(OwsControllerBase, self).__call__(environ, start_response) 
     65            return super(OWSControllerBase, self).__call__(environ, start_response) 
    6666        else: 
    6767            try: 
    6868                self._fixOwsAction(environ) 
    69                 return super(OwsControllerBase, self).__call__(environ, start_response) 
     69                return super(OWSControllerBase, self).__call__(environ, start_response) 
    7070            except OWS_E.OwsError, e: 
    7171                logger.exception(e) 
    7272 
    73                 tmpl = genshiLoader.load('exception_report.xml') 
     73                tmpl = templateLoader.load('exception_report.xml') 
    7474                response.write(tmpl.generate(report=e.report).render('xml')) 
    7575                response.headers['content-type'] = 'text/xml' 
     
    116116def addOperation(opName, formats=[]): 
    117117    ops = c.capabilities.operationsMetadata.operationDict 
    118     ops[opName] = helpers.operation(url_for(), formats=formats) 
    119  
    120 def addLayer(name, title, abstract, srs, bbox, dimensions={}): 
     118    ops[opName] = helpers.operation(url_for(qualified=True, action="index")+'?', formats=formats) 
     119 
     120def addLayer(name, title, abstract, srss, bbox, dimensions={}): 
    121121    """ 
    122122    @param dimensions: Dictionary of dictionaries D[k1][k2]=val where 
     
    131131        c.capabilities.contents = Contents() 
    132132 
    133     layer = helpers.wms_layer(name, title, srs, bbox, abstract) 
     133    layer = helpers.wms_layer(name, title, srss, bbox, abstract) 
    134134 
    135135    for k1, kwargs in dimensions.items(): 
     
    159159#----------------------------------------------------------------------------- 
    160160 
    161 class OwsController(OwsControllerBase): 
    162     """ 
    163     Adds basic GetCapabilities response to OwsControllerBase. 
     161class OWSController(OWSControllerBase): 
     162    """ 
     163    Adds basic GetCapabilities response to OWSControllerBase. 
    164164 
    165165    @cvar service: If None does not enforce the SERVICE parameter.  Otherwise 
     
    175175    owsOperations = ['GetCapabilities'] 
    176176 
    177     # Override these attributes to control how OwsController responds to 
     177    # Override these attributes to control how OWSController responds to 
    178178    # GetCapabilities 
    179179    service = None 
Note: See TracChangeset for help on using the changeset viewer.