[Zope-Checkins] CVS: Zope/lib/python/ZPublisher - Test.py:1.37

Andreas Jung andreas@zope.com
Mon, 1 Oct 2001 10:56:15 -0400


Update of /cvs-repository/Zope/lib/python/ZPublisher
In directory cvs.zope.org:/tmp/cvs-serv14055

Modified Files:
	Test.py 
Log Message:
publish(): added additional 'fp' parameter to specify filehandle to write
output to (needed to catch output for
AccessControl/securitySuite/testSecurity.py).



=== Zope/lib/python/ZPublisher/Test.py 1.36 => 1.37 ===
             u=None,p=None,d=None,t=None,e=None,s=None,pm=0,
             extra=None, request_method='GET',
+            fp=None,
             stdin=sys.stdin):
 
     profile=p
@@ -359,7 +360,6 @@
         __main__.file=file
         __main__.env=env
         __main__.extra=extra
-        print profile
         publish_module(file, environ=env, stdout=open('/dev/null','w'),
                        extra=extra, stdin=stdin)
         c=("for i in range(%s): "
@@ -440,8 +440,14 @@
         publish_module_pm(file, environ=env, stdout=stdout, extra=extra)
         print '\n%s\n' % ('_'*60)
     else:
-        if silent: stdout=open('/dev/null','w')
-        else: stdout=sys.stdout
+        if silent: 
+            stdout=open('/dev/null','w')
+        else: 
+            if fp and hasattr(fp,'write'):
+                stdout = fp
+            else:
+                stdout=sys.stdout
+
         publish_module(file, environ=env, stdout=stdout, extra=extra)
         print '\n%s\n' % ('_'*60)