8 def application_factory(global_conf, conf='zope.conf'):
9 zope_conf = os.path.join(global_conf['here'], conf)
10 return zope.app.wsgi.getWSGIApplication(zope_conf)
12 def interactive_debug_prompt(zope_conf='zope.conf'):
13 db = zope.app.wsgi.config(zope_conf)
14 debugger = zope.app.debug.Debugger.fromDatabase(db)
15 # Invoke an interactive interpreter shell
16 banner = ("Welcome to the interactive debug prompt.\n"
17 "The 'root' variable contains the ZODB root folder.\n"
18 "The 'app' variable contains the Debugger, 'app.publish(path)' "
19 "simulates a request.")
20 code.interact(banner=banner, local={'debugger': debugger,
22 'root': debugger.root()})
24 class ControllerCommands(zdaemon.zdctl.ZDCmd):
26 def do_debug(self, rest):
27 interactive_debug_prompt()
30 print "debug -- Initialize the application, providing a debugger"
31 print " object at an interactive Python prompt."
33 def zdaemon_controller(zdaemon_conf='zdaemon.conf'):
34 args = ['-C', zdaemon_conf] + sys.argv[1:]
35 zdaemon.zdctl.main(args, options=None, cmdclass=ControllerCommands)