[Checkins] SVN: zc.zope3recipes/trunk/ Now debugzope takes the servers key of the application into account.

Aaron Lehmann aaron at zope.com
Thu Jul 26 19:47:08 EDT 2007


Log message for revision 78368:
  Now debugzope takes the servers key of the application into account.
  
  

Changed:
  U   zc.zope3recipes/trunk/setup.py
  U   zc.zope3recipes/trunk/zc/zope3recipes/README.txt
  U   zc.zope3recipes/trunk/zc/zope3recipes/debugzope.py
  U   zc.zope3recipes/trunk/zc/zope3recipes/recipes.py

-=-
Modified: zc.zope3recipes/trunk/setup.py
===================================================================
--- zc.zope3recipes/trunk/setup.py	2007-07-26 22:18:54 UTC (rev 78367)
+++ zc.zope3recipes/trunk/setup.py	2007-07-26 23:47:07 UTC (rev 78368)
@@ -21,7 +21,7 @@
 name = "zc.zope3recipes"
 setup(
     name = name,
-    version = "0.5.4",
+    version = "0.5.5",
     author = "Jim Fulton",
     author_email = "jim at zope.com",
     description = "ZC Buildout recipe for defining Zope 3 applications",

Modified: zc.zope3recipes/trunk/zc/zope3recipes/README.txt
===================================================================
--- zc.zope3recipes/trunk/zc/zope3recipes/README.txt	2007-07-26 22:18:54 UTC (rev 78367)
+++ zc.zope3recipes/trunk/zc/zope3recipes/README.txt	2007-07-26 23:47:07 UTC (rev 78368)
@@ -109,10 +109,13 @@
       '/zope3recipes',
       ]
     <BLANKLINE>
+    import zope.app.twisted.main
+    <BLANKLINE>
+    <BLANKLINE>
     import zc.zope3recipes.debugzope
     <BLANKLINE>
     if __name__ == '__main__':
-        zc.zope3recipes.debugzope.debug()
+        zc.zope3recipes.debugzope.debug(main_module=zope.app.twisted.main)
 
 
 Building Zope 3 Applications (from Zope 3 checkouts/tarballs)
@@ -262,10 +265,13 @@
       '/zope3recipes',
       ]
     <BLANKLINE>
+    import zope.app.twisted.main
+    <BLANKLINE>
+    <BLANKLINE>
     import zc.zope3recipes.debugzope
     <BLANKLINE>
     if __name__ == '__main__':
-        zc.zope3recipes.debugzope.debug()
+        zc.zope3recipes.debugzope.debug(main_module=zope.app.twisted.main)
 
 Note that the runzope shown above uses the default, twisted-based
 server components.  It's possible to specify which set of server
@@ -386,7 +392,28 @@
     if __name__ == '__main__':
         zope.app.server.main.main()
 
+The debugzope script has also been modified to take this into account.
 
+    >>> cat('parts', 'myapp', 'debugzope')
+    #!/usr/local/bin/python2.4
+    <BLANKLINE>
+    import sys
+    sys.path[0:0] = [
+      '/sample-buildout/demo2',
+      '/sample-buildout/demo1',
+      '/zope3/src',
+      '/zope3recipes',
+      ]
+    <BLANKLINE>
+    import zope.app.server.main
+    <BLANKLINE>
+    <BLANKLINE>
+    import zc.zope3recipes.debugzope
+    <BLANKLINE>
+    if __name__ == '__main__':
+        zc.zope3recipes.debugzope.debug(main_module=zope.app.server.main)
+
+
 Legacy Functional Testing Support
 ---------------------------------
 

Modified: zc.zope3recipes/trunk/zc/zope3recipes/debugzope.py
===================================================================
--- zc.zope3recipes/trunk/zc/zope3recipes/debugzope.py	2007-07-26 22:18:54 UTC (rev 78367)
+++ zc.zope3recipes/trunk/zc/zope3recipes/debugzope.py	2007-07-26 23:47:07 UTC (rev 78368)
@@ -18,15 +18,14 @@
 
 import os, sys, traceback
 import zope.app.debug
-import zope.app.twisted.main
 import zope.app.appsetup.interfaces
 from zope.event import notify
 import zope.app.appsetup.product
 
-def load_options(args):
-    options = zope.app.twisted.main.ZopeOptions()
+def load_options(args, main_module=None):
+    options = main_module.ZopeOptions()
     options.schemadir = os.path.dirname(os.path.abspath(
-        zope.app.twisted.main.__file__))
+        main_module.__file__))
     options.positional_args_allowed = True
     options.realize(args)
 
@@ -52,11 +51,11 @@
         __name__ = '__main__',
         )
 
-def debug(args=None):
+def debug(args=None, main_module=None):
     if args is None:
         args = sys.argv[1:]
 
-    options = load_options(args)
+    options = load_options(args, main_module=main_module)
     try:
         globs = zglobals(options.configroot)
     except:

Modified: zc.zope3recipes/trunk/zc/zope3recipes/recipes.py
===================================================================
--- zc.zope3recipes/trunk/zc/zope3recipes/recipes.py	2007-07-26 22:18:54 UTC (rev 78367)
+++ zc.zope3recipes/trunk/zc/zope3recipes/recipes.py	2007-07-26 23:47:07 UTC (rev 78368)
@@ -77,10 +77,14 @@
 
             options['extra-paths'] = extra_paths + '\n' + this_loc
 
+            initialization = 'import %s\n' % server_module
+            arguments = 'main_module=%s' % server_module
             zc.buildout.easy_install.scripts(
                 [('debugzope', 'zc.zope3recipes.debugzope', 'debug')],
                 ws, options['executable'], dest,
                 extra_paths = options['extra-paths'].split(),
+                initialization = initialization,
+                arguments = arguments,
                 )
 
             ftesting_zcml = options.get('ftesting.zcml')



More information about the Checkins mailing list