Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.