def stopTurboGears(): # end all transactions and clear out the hubs to # help ensure proper reloading in autoreload situations for hub in hub_registry: hub.end() hub_registry.clear() stop_bonjour() # Shut down all TurboGears extensions extensions= pkg_resources.iter_entry_points( "turbogears.extensions" ) for entrypoint in extensions: ext= entrypoint.load() if hasattr(ext, "shutdown_extension"): ext.shutdown_extension() for item in call_on_shutdown: item() if config.get("tg.scheduler", False): scheduler._stop_scheduler() log.info("Scheduler stopped")
log.exception("Error loading TurboGears extension plugin '%s': %s", entrypoint, e) continue if hasattr(ext, "shutdown_extension"): try: ext.shutdown_extension() except Exception, e: log.exception( "Error shutting down TurboGears extension '%s': %s", entrypoint, e) for item in call_on_shutdown: item() if config.get("tg.scheduler", False): scheduler._stop_scheduler() log.info("Scheduler stopped") def start_server(root): cherrypy.root = root if config.get('tg.fancy_exception', False): server.start(server=SimpleWSGIServer()) else: server.start() # module classes class SimpleWSGIServer(CherryPyWSGIServer): """A WSGI server that accepts a WSGI application as a parameter.""" RequestHandlerClass = CPHTTPRequest def __init__(self):
def tearDown(self): _stop_scheduler()