Context: Imagine that you have a standard CherryPy hello word app:
def index(self):
return \"Hello world!\"
index.exposed = True
As i was looking for this and it's now outdated, i found it useful to provide the correct (2012ish) answer. Simply add this at the beginning of the function that handles your url :
cherrypy.request.hooks.attach('on_end_request', mycallbackfunction)
There's more infos on hooks in the documentation but it's not very clear to me.