[Checkins]
SVN: Sandbox/philikon/zopeproject/trunk/zopeproject/zope_app/
* By now, the default application_factory was exactly like
zope.app.wsgi.getApplication(),
Philipp von Weitershausen
philikon at philikon.de
Fri Sep 14 13:26:20 EDT 2007
Log message for revision 79649:
* By now, the default application_factory was exactly like zope.app.wsgi.getApplication(),
so let's just use that.
* Use the new config() function zope.app.wsgi to build an interactive debugging prompt,
much like bin/debugzope in Zope 3 or bin/zopectl debug in Zope 2. It's called bin/debug.
Changed:
U Sandbox/philikon/zopeproject/trunk/zopeproject/zope_app/+package+/application.py
U Sandbox/philikon/zopeproject/trunk/zopeproject/zope_app/setup.py_tmpl
-=-
Modified: Sandbox/philikon/zopeproject/trunk/zopeproject/zope_app/+package+/application.py
===================================================================
--- Sandbox/philikon/zopeproject/trunk/zopeproject/zope_app/+package+/application.py 2007-09-14 17:05:42 UTC (rev 79648)
+++ Sandbox/philikon/zopeproject/trunk/zopeproject/zope_app/+package+/application.py 2007-09-14 17:26:19 UTC (rev 79649)
@@ -1,32 +1,20 @@
-import sys, os
-import ZConfig
-import zope.event
-import zope.app.appsetup
-from zope.app.wsgi import WSGIPublisherApplication
-from zope.app.appsetup.appsetup import multi_database
-from zope.app.appsetup.interfaces import DatabaseOpened, ProcessStarting
+import os
+import code
+import zope.app.wsgi
+import zope.app.debug
def application_factory(global_conf, conf='zope.conf'):
- # load 'zope.conf' configuration
- schema_xml = os.path.join(
- os.path.dirname(zope.app.appsetup.__file__), 'schema', 'schema.xml')
- schema = ZConfig.loadSchema(schema_xml)
- options, handlers = ZConfig.loadConfig(
- schema, os.path.join(global_conf['here'], conf))
+ zope_conf = os.path.join(global_conf['here'], conf)
+ return zope.app.wsgi.getWSGIApplication(zope_conf)
- if options.path:
- sys.path[0:0] = [os.path.abspath(p) for p in options.path]
- options.eventlog()
-
- # load ZCML configuration
- features = ()
- if options.devmode:
- features += ('devmode',)
- zope.app.appsetup.config(options.site_definition, features)
-
- # notify of ZODB database opening
- db = multi_database(options.databases)[0][0]
- zope.event.notify(DatabaseOpened(db))
-
- zope.event.notify(ProcessStarting())
- return WSGIPublisherApplication(db)
+def debug(zope_conf='zope.conf'):
+ db = zope.app.wsgi.config(zope_conf)
+ debugger = zope.app.debug.Debugger.fromDatabase(db)
+ # Invoke an interactive interpreter shell
+ banner = ("Welcome to the interactive debug prompt.\n"
+ "The 'root' variable contains the ZODB root folder.\n"
+ "The 'app' variable contains the Debugger, 'app.publish(path)' "
+ "simulates a request.")
+ code.interact(banner=banner, local={'debugger': debugger,
+ 'app': debugger,
+ 'root': debugger.root()})
Modified: Sandbox/philikon/zopeproject/trunk/zopeproject/zope_app/setup.py_tmpl
===================================================================
--- Sandbox/philikon/zopeproject/trunk/zopeproject/zope_app/setup.py_tmpl 2007-09-14 17:05:42 UTC (rev 79648)
+++ Sandbox/philikon/zopeproject/trunk/zopeproject/zope_app/setup.py_tmpl 2007-09-14 17:26:19 UTC (rev 79649)
@@ -28,7 +28,7 @@
'zope.publisher',
'zope.size',
'zope.traversing',
- 'zope.app.wsgi',
+ 'zope.app.wsgi>=3.4.0',
'zope.app.appsetup',
'zope.app.authentication',
'zope.app.traversing',
@@ -38,6 +38,8 @@
'zope.app.zcmlfiles',
],
entry_points = """
+ [console_scripts]
+ debug = ${package}.application:debug
[paste.app_factory]
main = ${package}.application:application_factory
"""
More information about the Checkins
mailing list