# HG changeset patch # User cmlenz # Date 1196896610 0 # Node ID fdebe71666ce0486139a30618036ef16e50e206d # Parent c50d2705016e229426672fc5303d5bd1e06cc3bc Fix compatibility of tutorial code with CherryPy 3.1. Closes #159. diff --git a/examples/tutorial/geddit/controller.py b/examples/tutorial/geddit/controller.py --- 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