List Info

Thread: Case-insensitive parameters




Case-insensitive parameters
user name
2006-04-02 23:18:20
Hello folks,
  I'm a new cherrypy user trying to implement a web service
and I've
gotten everything working but...

 I'm trying to implement the OGC Web Mapping Services
standard which
does not require any specific case for it's input
parameters. For
example, according to the spec, all of these are valid:

 index?bbox=120,20,70,50
 index?BBOX=120,20,70,50
 index?BBox=120,20,70,50

My code has all variables as lower case. Is there any way to
convert
all input parameter names to lower-case?

Thanks for the help,
Matt Perry


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---

Case-insensitive parameters
user name
2006-04-03 01:06:59
you could make a filter that alters the request line.
for example:

class LowerParams:
    def before_request_body(this):
 ;       cherrypy.request.params = dict(
        [ (x[0].lower(),x[1]) for x in cherrypy.request.params.items() ]
        )

and have something like:

class Root:
    _cp_filters = [ LowerParams(), ]

    ....



On 4/3/06, gmail.com">perrygeogmail.com <gmail.com"> perrygeogmail.com> wrote:

Hello folks,
&nbsp; I'm a new cherrypy user trying to implement a web service and I've
gotten everything working but...

I'm trying to implement the OGC Web Mapping Services standard which
does not require any specific case for it's input parameters. For
example, according to the spec, all of these are valid:

index?bbox=120,20,70,50
index?BBOX=120,20,70,50
index?BBox=120,20,70,50

My code has all variables as lower case. Is there any way to convert
all input parameter names to lower-case?

Thanks for the help,
Matt Perry





--
http://ionel.zapto.org
ionel.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users&quot; group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )