[Checkins] SVN: zope.testbrowser/branches/jinty-webtest3/src/zope/testbrowser/ * Remove/re-work references to Zope's publisher in the documentation.

Brian Sutherland jinty at web.de
Sat Feb 12 12:36:37 EST 2011


Log message for revision 120300:
  * Remove/re-work references to Zope's publisher in the documentation.
  * Remove some unused imports.
  * Code simplification.
  

Changed:
  U   zope.testbrowser/branches/jinty-webtest3/src/zope/testbrowser/README.txt
  U   zope.testbrowser/branches/jinty-webtest3/src/zope/testbrowser/ftests/wsgitestapp.py
  U   zope.testbrowser/branches/jinty-webtest3/src/zope/testbrowser/wsgi.py

-=-
Modified: zope.testbrowser/branches/jinty-webtest3/src/zope/testbrowser/README.txt
===================================================================
--- zope.testbrowser/branches/jinty-webtest3/src/zope/testbrowser/README.txt	2011-02-12 13:42:24 UTC (rev 120299)
+++ zope.testbrowser/branches/jinty-webtest3/src/zope/testbrowser/README.txt	2011-02-12 17:36:36 UTC (rev 120300)
@@ -22,7 +22,7 @@
 
 There is also a special version of the ``Browser`` class which uses
 `WebTest`_ and can be used to do functional testing of WSGI
-applications, it can be imported from ``zope.testbrowser.wsgi``:
+applications. It can be imported from ``zope.testbrowser.wsgi``:
 
     >>> from zope.testbrowser.wsgi import Browser
     >>> from wsgiref.simple_server import demo_app
@@ -1310,11 +1310,11 @@
     True
 
 
-Handling Errors when using Zope 3's Publisher
----------------------------------------------
+Handling Errors
+---------------
 
-A very useful feature of the publisher is the automatic graceful handling of
-application errors, such as invalid URLs:
+Often WSGI middleware or the application itself gracefully handle application
+errors, such as invalid URLs:
 
     >>> browser.open('http://localhost/invalid')
     Traceback (most recent call last):
@@ -1322,7 +1322,7 @@
     HTTPError: HTTP Error 404: Not Found
 
 Note that the above error was thrown by ``mechanize`` and not by the
-publisher.  For debugging purposes, however, it can be very useful to see the
+application.  For debugging purposes, however, it can be very useful to see the
 original exception caused by the application.  In those cases you can set the
 ``handleErrors`` property of the browser to ``False``.  It is defaulted to
 ``True``:
@@ -1330,21 +1330,21 @@
     >>> browser.handleErrors
     True
 
-So when we tell the publisher not to handle the errors,
+So when we tell the application not to handle the errors,
 
     >>> browser.handleErrors = False
 
-we get a different, Zope internal error:
+we get a different, internal error from the application:
 
     >>> browser.open('http://localhost/invalid')
     Traceback (most recent call last):
     ...
     NotFound: /invalid
 
-NB: Setting the handleErrors attribute to False will only change
-    anything if the http server you're testing is using Zope 3's
-    publisher or can otherwise respond appropriately to an
-    'X-zope-handle-errors' header in requests.
+NB: Setting the handleErrors attribute to False will only change anything if
+    the WSGI application obeys the wsgi.handleErrors or paste.throw_errors
+    WSGI environment variables. i.e. it does not catch and handle the original
+    exception when these are set appropriately.
 
 When the testbrowser is raising HttpErrors, the errors still hit the test.
 Sometimes we don't want that to happen, in situations where there are edge

Modified: zope.testbrowser/branches/jinty-webtest3/src/zope/testbrowser/ftests/wsgitestapp.py
===================================================================
--- zope.testbrowser/branches/jinty-webtest3/src/zope/testbrowser/ftests/wsgitestapp.py	2011-02-12 13:42:24 UTC (rev 120299)
+++ zope.testbrowser/branches/jinty-webtest3/src/zope/testbrowser/ftests/wsgitestapp.py	2011-02-12 17:36:36 UTC (rev 120300)
@@ -20,8 +20,6 @@
 from webob import Request, Response
 from zope.pagetemplate.pagetemplatefile import PageTemplateFile
 
-from zope.testbrowser import ftests
-
 class NotFound(Exception):
     pass
 
@@ -30,9 +28,8 @@
 class MyPageTemplateFile(PageTemplateFile):
 
     def pt_getContext(self, args, *extra_args, **kw):
-        request = args[0]
         namespace = super(MyPageTemplateFile, self).pt_getContext(args, *extra_args, **kw)
-        namespace['request'] = request
+        namespace['request'] = args[0]
         return namespace
 
 class WSGITestApplication(object):

Modified: zope.testbrowser/branches/jinty-webtest3/src/zope/testbrowser/wsgi.py
===================================================================
--- zope.testbrowser/branches/jinty-webtest3/src/zope/testbrowser/wsgi.py	2011-02-12 13:42:24 UTC (rev 120299)
+++ zope.testbrowser/branches/jinty-webtest3/src/zope/testbrowser/wsgi.py	2011-02-12 17:36:36 UTC (rev 120300)
@@ -14,15 +14,8 @@
 """WSGI-specific testing code
 """
 
-from __future__ import absolute_import
-
-import cStringIO
-import Cookie
-import httplib
-import socket
 import sys
 
-import mechanize
 from webtest import TestApp
 
 import zope.testbrowser.browser



More information about the checkins mailing list