[Zope3-checkins] CVS: Zope3 - z3.py:1.5

Jim Fulton jim@zope.com
Thu, 24 Oct 2002 11:37:32 -0400


Update of /cvs-repository/Zope3
In directory cvs.zope.org:/tmp/cvs-serv28684

Modified Files:
	z3.py 
Log Message:
Added a facility to make it easy to get to Zope 3 from a Python 
prompt. Also added rudimentary debugging support.

>From lib/python (or with lib/python in your Python path), start Python
and:

  from Zope.App import Application

  # Create an Application object
  app = Application('../../Data.fs', '../../site.zcml')

to get the applicatiuon root object on an open database connection,
call the application object:

  root = app()

to execute a request for a path:

  app.debug(path)

You can pass various extra parameters to debug to specify environment
variables and so on. (For now, see lib/python/Zope/App/_app.py.)

To prevent exceptions from being caught, provide the pm keyword
argument:

  app.debug(path, pm=1)

This will let you do pdb post-mortem debugging of errors.

Added a little bit of framework for site initialization, so that the
debugging environment and z3.py use the same initialization code.



=== Zope3/z3.py 1.4 => 1.5 ===
--- Zope3/z3.py:1.4	Tue Aug 13 13:46:12 2002
+++ Zope3/z3.py	Thu Oct 24 11:37:02 2002
@@ -43,22 +43,13 @@
     # temp hack
     dir = os.getcwd()
 
-    from Zope.Configuration.xmlconfig import XMLConfig
-
-    # Set user to system_user, so we can do anything we want
-    from Zope.Security.SecurityManagement import system_user
-    from Zope.Security.SecurityManagement import newSecurityManager
-    newSecurityManager(system_user)
-
-    # Load server-independent site config
-    XMLConfig(os.path.join(dir, 'site.zcml'))()
+    # Do global software config
+    from Zope.App import config
+    config('site.zcml')
     
     # Load server config
+    from Zope.Configuration.xmlconfig import XMLConfig
     XMLConfig(os.path.join(dir, 'zserver.zcml'))()
-
-    # Reset user
-    from Zope.Security.SecurityManagement import noSecurityManager
-    noSecurityManager()
 
     try:
         asyncore.loop()