Mercurial > genshi > genshi-test
changeset 664:19e8a05adc86
Fix compatibility of tutorial code with CherryPy 3.1. Closes #159.
author | cmlenz |
---|---|
date | Wed, 05 Dec 2007 23:16:50 +0000 |
parents | 641d76ae430c |
children | 281ab9fb4b04 |
files | examples/tutorial/geddit/controller.py |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/examples/tutorial/geddit/controller.py +++ b/examples/tutorial/geddit/controller.py @@ -111,7 +111,10 @@ pickle.dump(data, fileobj) finally: fileobj.close() - cherrypy.engine.on_stop_engine_list.append(_save_data) + if hasattr(cherrypy.engine, 'subscribe'): # CherryPy >= 3.1 + cherrypy.engine.subscribe('stop', _save_data) + else: + cherrypy.engine.on_stop_engine_list.append(_save_data) # Some global configuration; note that this could be moved into a # configuration file