[Zope3-checkins] CVS: Zope3/lib/python/Zope/Configuration - xmlconfig.py:1.9

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


Update of /cvs-repository/Zope3/lib/python/Zope/Configuration
In directory cvs.zope.org:/tmp/cvs-serv28684/lib/python/Zope/Configuration

Modified Files:
	xmlconfig.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/lib/python/Zope/Configuration/xmlconfig.py 1.8 => 1.9 ===
--- Zope3/lib/python/Zope/Configuration/xmlconfig.py:1.8	Thu Sep  5 16:25:09 2002
+++ Zope3/lib/python/Zope/Configuration/xmlconfig.py	Thu Oct 24 11:37:02 2002
@@ -18,6 +18,7 @@
 
 import os
 import name
+from os.path import abspath
 from xml.sax import make_parser
 from xml.sax.xmlreader import InputSource
 from xml.sax.handler import ContentHandler, feature_namespaces
@@ -261,7 +262,7 @@
 
     def __init__(self, file_name, module=_NO_MODULE_GIVEN):
         if module is not None and module is not _NO_MODULE_GIVEN:
-            module_dir = os.path.split(module.__file__)[0]
+            module_dir = abspath(os.path.split(module.__file__)[0])
             file_name = os.path.join(module_dir, file_name)