[MapProxy] uppercase values for get keys (WMSMapRequestParams)

Adon Metcalfe adon.metcalfe at gmail.com
Sat Mar 26 22:33:30 EDT 2011


Hi All,

I have to use a problematic WMS (landgates virtual mosaic), in that it only
accepts uppercase keys for requests, and thought I'd share the somewhat
dodgy workaround (makes all request keys uppercase), which appears to work
fine with all the other case insensitive services I'm using. I'm not exactly
sure how to go about making an option that gets passed all the way through
to the RequestParams object (maybe override query_string with a new
WMSMapUpperRequestParams class and add a new source type (wms_upper?) that
uses it over WMSMapRequestParams for sources requiring uppercase
parameters?)

    @property
    def query_string(self):
        """
        The map request as a query string (the order is not guaranteed).

        >>> RequestParams(dict(foo='egg', bar='ham%eggs',
baz=100)).query_string
        'BAZ=100&FOO=egg&BAR=ham%25eggs'
        """
        kv_pairs = []
        for key, values in self.params.iteritems():
            value = ','.join(str(v) for v in values)
            kv_pairs.append(key.upper() + '=' + urllib.quote_plus(value,
safe=','))
        return '&'.join(kv_pairs)

Kind Regards,
Adon

-- 
Adon Metcalfe
Labyrinth Data Services Pty Ltd
http://www.labyrinthdata.net.au
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapproxy/attachments/20110327/186567b0/attachment.html


More information about the MapProxy mailing list