Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import cherrypy
- @cherrypy.tools.register('before_finalize', priority=60)
- def noisy_hook_1():
- raise ValueError('hook 1 failed')
- @cherrypy.tools.register('before_finalize', priority=60)
- def noisy_hook_2():
- raise ValueError('hook 2 failed')
- class Server:
- config = {
- 'global': {
- 'server.socket_host': '::0',
- },
- '/': {
- 'tools.noisy_hook_1.on': True,
- 'tools.noisy_hook_1.failsafe': True,
- 'tools.noisy_hook_2.on': True,
- 'tools.noisy_hook_2.failsafe': True,
- }
- }
- @cherrypy.expose
- def index(self):
- return "Hello World"
- @classmethod
- def run(cls):
- cherrypy.quickstart(cls(), config=cls.config)
- __name__ == '__main__' and Server.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement