[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/doc/DEBUG.txt
Convert DEBUG.txt to reStructuredText.
Fred L. Drake, Jr.
fred at zope.com
Thu Jul 1 13:43:59 EDT 2004
Log message for revision 26018:
Convert DEBUG.txt to reStructuredText.
-=-
Modified: Zope3/branches/ZopeX3-3.0/doc/DEBUG.txt
===================================================================
--- Zope3/branches/ZopeX3-3.0/doc/DEBUG.txt 2004-07-01 17:42:56 UTC (rev 26017)
+++ Zope3/branches/ZopeX3-3.0/doc/DEBUG.txt 2004-07-01 17:43:59 UTC (rev 26018)
@@ -1,91 +1,101 @@
+=======================
Using the Zope Debugger
+=======================
- Introduction
-
- Zope3 includes a mechanism to debug an object publishing request,
- similar to the Zope2
- "debug mechanism":http://www.zope.org/Members/mcdonc/HowTos/UsingTheZopeDebugger
+Introduction
+------------
- Setting up Environment
+Zope3 includes a mechanism to debug an object publishing request,
+similar to the Zope2
+`debug mechanism`_.
- Setup your PYTHONPATH environment variable to include
- src. ie (unix bash syntax)::
+.. _debug mechanism:
+ http://www.zope.org/Members/mcdonc/HowTos/UsingTheZopeDebugger
- cd Zope3
- export PYTHONPATH=$PWD/src:$PYTHONPATH
-
- To start interacting with the debugger you need to initialize the
- zope application::
+Setting up Environment
+----------------------
- $ python2.3
- >>> from zope.app.debug import Debugger
- >>> debugger = Debugger()
+Setup your PYTHONPATH environment variable to include src. ie (unix
+bash syntax)::
+ cd Zope3
+ export PYTHONPATH=$PWD/src:$PYTHONPATH
- Note that you can pass a database file name and a site ZCML file
- to the debugger:
+To start interacting with the debugger you need to initialize the zope
+application::
- >>> Debugger('path/to/zodb/', 'path/to/site.zcml')
-
- But you can generally let the debugger figure out where they are.
+ $ python2.3
+ >>> from zope.app.debug import Debugger
+ >>> debugger = Debugger()
- XXX In the future, the debugger should have it's own ZConfig file.
-
- Using the Debugger
- There are several methods you can call on the application object
- for testing purposes.
+Note that you can pass a database file name and a site ZCML file to
+the debugger:
- Publish
+ >>> Debugger('path/to/zodb/', 'path/to/site.zcml')
- The 'publish' method executes a request as the publisher would
- and prints the response headers and body::
+But you can generally let the debugger figure out where they are.
- >>> debugger.publish(path='/folder/content_object')
+XXX In the future, the debugger should have it's own ZConfig file.
- Run
- The 'run' method executes a request with the publisher's normal
- error handling disabled and without outputting anything. This is
- useful for use with Python's post-mortem.
+Using the Debugger
+------------------
- >>> debugger.run(path='/folder/content_object')
- # an exception is raised
- >>> import pdb; pdb.pm()
- # enters the python post-mortem debugger
+There are several methods you can call on the application object for
+testing purposes.
- Debug
-
- The 'debug' method starts up the publisher in the python
- debugger, with an extra convenience break point, setup just before
- the published object call::
+Publish
+ The `publish()` method executes a request as the publisher would and
+ prints the response headers and body::
- >>> debugger.debug(path='/folder/content_object')
- * Type c<cr> to jump to published object call.
- pdb>
-
- Arguments
+ >>> debugger.publish(path='/folder/content_object')
- All of the debugger object's debug methods take optional
- arguments, the more common/useful ones...
+Run
+ The `run()` method executes a request with the publisher's normal
+ error handling disabled and without outputting anything. This is
+ useful for use with Python's post-mortem.
- - path - the url path to debug
+ >>> debugger.run(path='/folder/content_object')
+ # an exception is raised
+ >>> import pdb; pdb.pm()
+ # enters the python post-mortem debugger
- - basic - user:password used for HTTP basic auth (it will be
- base64 encoded by the debug method).
+Debug
+ The `debug()` method starts up the publisher in the python debugger,
+ with an extra convenience break point, setup just before the
+ published object call::
- Accessing objects (without the debugger)
+ >>> debugger.debug(path='/folder/content_object')
+ * Type c<cr> to jump to published object call.
+ pdb>
- You can use the application object to open a database connection
- to access your objects. If the application object is called, it
- opens a database connection and fetches the root object::
+Arguments
+~~~~~~~~~
- root = debugger.root()
+All of the debugger object's debug methods take optional arguments,
+the more common/useful ones...
- For example, to list the objects in the root folder:
+`path`
+ the URL path to debug
- print list(root)
+`basic`
+ user:password used for HTTP basic auth (it will be base64 encoded by
+ the debug method).
- Also note that, after initializing the application, by creating
- the root object, you can access any global services setup during
- initialization.
+Accessing objects (without the debugger)
+----------------------------------------
+
+You can use the application object to open a database connection to
+access your objects. If the application object is called, it opens a
+database connection and fetches the root object::
+
+ root = debugger.root()
+
+For example, to list the objects in the root folder::
+
+ print list(root)
+
+Also note that, after initializing the application, by creating the
+root object, you can access any global services setup during
+initialization.
More information about the Zope3-Checkins
mailing list