Ignore:
Timestamp:
21/02/08 12:20:58 (12 years ago)
Author:
spascoe
Message:
 
Location:
TI05-delivery/ows_framework/branches/ows_framework-refactor/ows_common/ows_common
Files:
1 added
2 edited

Legend:

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

    r3481 r3487  
    1818from ows_common import helpers 
    1919from ows_common.operations_metadata import * 
     20from ows_common.contents import Contents 
    2021 
    2122from genshi.template import TemplateLoader 
     
    110111                                                  param) 
    111112 
     113#----------------------------------------------------------------------------- 
     114# Functions that populate c.capabilities 
     115 
     116def addOperation(opName, formats=[]): 
     117    ops = c.capabilities.operationsMetadata.operationDict 
     118    ops[opName] = helpers.operation(url_for(), formats=formats) 
     119 
     120def addLayer(name, title, abstract, srs, bbox): 
     121    if c.capabilities.contents is None: 
     122        c.capabilities.contents = Contents() 
     123 
     124    layer = helpers.wms_layer(url_for(), name, title, srs, bbox, abstract) 
     125    c.capabilities.contents.datasetSummaries.append(layer) 
     126 
     127def initCapabilities(): 
     128    """ 
     129    Initialise the capabilities object c.capabilities. 
     130 
     131    By default the server-wide configuration file is loaded and 
     132    used to populate some standard metadata.  The GetCapabilites 
     133    operation is added. 
     134 
     135    """ 
     136    # Load the basic ServiceMetadata from a config file 
     137    configFile = config.get('ows_server.capabilities_config') 
     138    c.capabilities = loadConfigFile(configFile) 
     139 
     140    om = OperationsMetadata(operationDict={}) 
     141    c.capabilities.operationsMetadata = om 
     142 
     143    addOperation('GetCapabilities', formats=['text/xml']) 
     144 
     145#----------------------------------------------------------------------------- 
    112146 
    113147class OwsController(OwsControllerBase): 
     
    150184 
    151185        # Get information required for the capabilities document 
    152         self._initCapabilities() 
     186        initCapabilities() 
    153187        self._loadCapabilities() 
    154188         
     
    157191        return self._renderCapabilities(version, format) 
    158192 
    159     def _initCapabilities(self): 
    160         """ 
    161         Initialise the capabilities object c.capabilities. 
    162  
    163         By default the server-wide configuration file is loaded and 
    164         used to populate some standard metadata.  The GetCapabilites 
    165         operation is added. 
    166  
    167         """ 
    168         # Load the basic ServiceMetadata from a config file 
    169         configFile = config.get('ows_server.capabilities_config') 
    170         c.capabilities = loadConfigFile(configFile) 
    171  
    172         getCap = helpers.operation(url_for(), formats=['text/xml']) 
    173         om = OperationsMetadata(operationDict=dict(GetCapabilities=getCap)) 
    174         c.capabilities.operationsMetadata = om 
    175193 
    176194    def _loadCapabilities(self): 
  • TI05-delivery/ows_framework/branches/ows_framework-refactor/ows_common/ows_common/pylons/templates/wms_capabilities_1_1_1.xml

    r3481 r3487  
    123123    </py:if> 
    124124     
    125     <Layer py:if="sm.contents is not None" 
    126            py:replace="layer(sm.contents.datasetSummaries[0])"/> 
     125    <Layer py:if="sm.contents is not None"> 
     126      <Title>Contents</Title> 
     127      <Layer py:for="ds in sm.contents.datasetSummaries" 
     128             py:replace="markupLayer(ds)"/> 
     129    </Layer> 
    127130  </Capability> 
    128131</WMT_MS_Capabilities> 
Note: See TracChangeset for help on using the changeset viewer.