Mercurial > genshi > mirror
changeset 664:fdebe71666ce trunk
Fix compatibility of tutorial code with CherryPy 3.1. Closes #159.
author | cmlenz |
---|---|
date | Wed, 05 Dec 2007 23:16:50 +0000 |
parents | c50d2705016e |
children | 3ee92ec99ad9 |
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