[mod_python] WPS 1.0.0 problem with KVP

Jorey Bump list at joreybump.com
Wed Jul 23 11:32:13 EDT 2008


The semicolon (";") is a reserved character in RFC 3986:

  http://tools.ietf.org/html/rfc3986#section-2.2

And the W3C recommends its use as an alternative to the ampersand ("&"):

<http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2.2>

So it looks like FieldStorage is behaving correctly.

To treat the semicolons as data in the query string, you might try 
percent-encoding them as "%3B".

  DataInputs=Input1=100;Input2=200

becomes:

  DataInputs=Input1=100%3BInput2=200

Then your application must decode the semicolons in the value returned 
for 'DataInputs' and split the key/value pairs, etc.


Graham Dumpleton wrote, at 07/23/2008 10:31 AM:
> Have you checked the HTTP RFC for GET URLs to see if what you are
> supplying is valid GET URL?
> 
> Can you supply reference to part of RFC that indicates it is.
> 
> Will save me trying to track it down. :-)
> 
> Graham
> 
> 2008/7/23 Jorge de Jesus <jorge.de-jesus at jrc.it>:
>> Hi to all
>>
>> I am programming an OGC's Web Processing Service (WPS) 1.0.0 ,  and  this
>> standard defines a KVP like this:
>>
>> http://foo.bar/foo?
>>  request=Execute&
>>  service=WPS&
>>  version=1.0.0&
>>  language=en-CA&
>>  Identifier=Buffer&
>>  [email protected]:href=http://foo.bar/foo;BufferDistance=10&
>>  ResponseDocument=BufferedPolygon&
>>  StoreExecuteResponse=true
>>
>>
>> The DataInputs contains several inputs separated by ";" and attribute
>> information separated by "@", in my case my Datainput is like this:
>>
>> DataInputs=Input1=100;Input2=200
>>
>> I then use util.FieldStorage(Request) to get the KVP but this class doesn't
>> split the request by the & but associates the key-values with the  =, so in
>> the end I will have a dictionary like this:
>>
>> {'DataInputs': [Field('DataInputs', 'Input1=10'0)], 'Input2':
>> [Field('Input2', '200')]}
>>
>> Basically Input2=10 is recognizes as another KVP and not a value from
>> DataInputs, I need something like this:
>>
>> {'DataInputs': [Field('DataInputs', 'Input1=10;Input2=200')]}
>>
>> I read the API documentation and I cant find a proper solution for the
>> problem, maybe to use a filter with some regular expression that would
>> change de = from the DataInput
>>
>> Any suggestions/help
>>
>> Thanks
>> Jorge
>>
>>
>> --
>> Ph.D. Jorge Samuel Mendes de Jesus
>>
>> European Commission (EC)
>> Joint Research Centre Directorate (DG JRC)
>> Institute for Environment and Sustainability (IES)
>> TP 441, Via Fermi 1
>> 21020 Ispra (VA)
>> Italy
>>
>> Phone: +39 0332 78 3536
>> Fax:   +39 0332 78 5466
>>
>> http://rem.jrc.cec.eu.int
>>
>> "The views expressed are purely those of the writer and may not in any
>> circumstances be regarded as stating an official position of the European
>> Commission"
>>
>> _______________________________________________
>> Mod_python mailing list
>> Mod_python at modpython.org
>> http://mailman.modpython.org/mailman/listinfo/mod_python
>>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python



More information about the Mod_python mailing list