jlowery a écrit :
> I notice in the cp3 docs that custom toolboxes
automatically have
> their own configuration space allocated.
>
> I have a tool like so:
>
> import cherrypy
> toolbox = cherrypy._cptools.Toolbox("kg")
>
> def unrepr_params(blank_nones=True):
> """ Tool that turns params into
python values and replaces
> empty values with None.
> """
> for param, value in
cherrypy.request.params.items():
> try:
> value = cherrypy.lib.unrepr(value)
> except:
> pass
> if value == '' and blank_nones:
> value = None
> cherrypy.request.params[param] = value
>
> toolbox.unrepr_params =
cherrypy.Tool('before_request_body',
> unrepr_params)
>
>
> With config like so:
>
> config = {
> '/': {
>
> 'engine.autoreload_on' : False,
>
> },
> 'kg' : {
> 'unrepr_params.on' : True,
> }
>
> }
>
> No dice. What am I doing wrong?
>
>
It should be:
config = {
'global': {
'engine.autoreload_on' : False,
},
'/': {
'kg.unrepr_params.on' : True,
}
}
'kg' is the namspace prefix.
- Sylvain
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users googlegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribe googlegroups.com
For more options, visit this group at h
ttp://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|