List Info

Thread: Case-insensitive parameters




Case-insensitive parameters
user name
2006-04-03 01:09:20
actualy alters the params dict not the request line
you got the idea... just have all parameters in lowercase in the serving methods

On 4/3/06, Maries Ionel Cristian <gmail.com">ionel.mcgmail.com> wrote:
you could make a filter that alters the request line.
for example:

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

and have something like:

class Root:
 &nbsp;  _cp_filters = [ LowerParams(), ]

 &nbsp;  ....



On 4/3/06, gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> perrygeogmail.com <gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> 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





ionel.



--
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]

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