Changeset 5283


Ignore:
Timestamp:
14/05/09 09:10:12 (10 years ago)
Author:
spascoe
Message:

Small change to how OWS Parameters are dealt with. [4572] which fixed
ticket:1014 intrudoced a problem where you could no longer use HTTP POST
to send a form-encoded request. Thissort of POST isn't part of the OGC
specs but is required by the UKCP portal. Therefore the old and new
behaviour is now controlled by a switch in the paster ini file:

cows.parameter_mode = html_4 => old behaviour where POST is supported
but ';' is interpreted against WPS-1.0
cows.parameter_mode = wps_1 => POST is not supported.

If ommited this option defaults to 'html_4'

Location:
cows/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cows/trunk/cows/pylons/ows_controller.py

    r5247 r5283  
    4545    ) 
    4646 
     47########################################################################## 
    4748# Configure 
    48 EXCEPTION_TYPE = config.get('cows.exception_type', 'ogc') 
     49# 
     50 
     51# Exception type should be 'ogc' for raising OGC exception XML or 'pylons' 
     52#     to let pylons handle errors. 
     53EXCEPTION_TYPE = config.get('cows.exception_type', 'ogc').lower() 
     54 
     55# Parameter mode changes the way QUERY_STRING is parsed.  In 'html_4' mode 
     56#     request.params is used, allowing the use of POST.  In 'wps_1' mode 
     57#     QUERY_STRING is parsed directly to work arround an issue where WPS-1.0 
     58#     treats ';' different to HTML4. 
     59PARAMETER_MODE = config.get('cows.parameter_mode', 'html_4').lower() 
     60 
     61########################################################################## 
    4962 
    5063class OWSControllerBase(WSGIController): 
     
    100113        log.debug('REQUEST: %s' % request) 
    101114         
    102         # request.params will use ';' as a QS separator which is not compatible 
    103         # with WPS-1.0.  Therefore we parse the QS ourselves. 
    104         qs = request.environ['QUERY_STRING'] 
    105         params = MultiDict(parse_qsl(qs, semicolon_separator=False, 
    106                                      keep_blank_values=True, strict_parsing=False)) 
    107          
     115        if PARAMETER_MODE == 'html_4': 
     116            params = request.params 
     117        elif PARAMETER_MODE == 'wps_1': 
     118            # request.params will use ';' as a QS separator which is not compatible 
     119            # with WPS-1.0.  Therefore we parse the QS ourselves. 
     120            qs = request.environ['QUERY_STRING'] 
     121            params = MultiDict(parse_qsl(qs, semicolon_separator=False, 
     122                                         keep_blank_values=True, strict_parsing=False)) 
     123        else: 
     124            raise ValueError("Value of cows.parameter_mode not recognised (%s)" % PARAMETER_MODE) 
     125 
    108126        for k in params: 
    109127            if k.lower() == 'x': 
  • cows/trunk/cows/pylons/project_templates/cows_server/+egg+.egg-info/paste_deploy_config.ini_tmpl_tmpl

    r4917 r5283  
    2727# Else WMS exceptions will be raised 
    2828cows.exception_type = pylons 
     29 
     30# Set parameter_mode if you need to treat ';' in the QUERY_STRING according 
     31# to WPS-1.0. 
     32# See http://proj.badc.rl.ac.uk/ndg/ticket/1014 for details 
     33# 
     34cows.parameter_mode = html_4 
     35#cows.parameter_mode = wps_1 
    2936 
    3037# Point to the service-level OWS configuration file 
  • cows/trunk/setup.py

    r5202 r5283  
    33setup( 
    44    name='cows', 
    5     version='0.2.4', 
     5    version='0.2.5', 
    66     
    77    description='CEDA OGC Web Services Framework (COWS).  A framework for creatining integrated OGC web services using Pylons', 
Note: See TracChangeset for help on using the changeset viewer.