Created
October 2, 2019 23:34
-
-
Save jaraco/dcb546c450e6d094c350fda4896f6a12 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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