Skip to content

Instantly share code, notes, and snippets.

@jaraco
Created October 2, 2019 23:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaraco/dcb546c450e6d094c350fda4896f6a12 to your computer and use it in GitHub Desktop.
Save jaraco/dcb546c450e6d094c350fda4896f6a12 to your computer and use it in GitHub Desktop.
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