i have class several routes , i'd them use json tools except one. how can exclude specific route tool (foo
in example below)?
import cherrypy class helloworld(object): _cp_config = { 'tools.json_out.on': true, 'tools.json_in.on': true, '/foo': { 'tools.json_out.on': true, 'tools.json_in.on': true } } @cherrypy.expose() def index(self): return "hello world!" @cherrypy.expose() def foo(self): return "hello world!" cherrypy.quickstart(helloworld())
you can cherrypy.config
decorator:
import cherrypy class helloworld(object): _cp_config = { 'tools.json_out.on': true, 'tools.json_in.on': true } @cherrypy.expose def index(self): return "hello world!" @cherrypy.expose @cherrypy.config(**{'tools.json_in.on': false, 'tools.json_out.on': false}) def foo(self): return "hello world!" cherrypy.quickstart(helloworld())
Comments
Post a Comment