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

Ken Manheimer klm at zope.com
Thu Mar 25 11:53:57 EST 2004


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

Modified Files:
      Tag: Zope-2_7-branch
	Test.py 
Log Message:
Provide the means for Zope.debug() consumers to adjust the signal
printed when the publish action finishes - now called the
"done_string".

The default (reproducing the original behavior) is dictated by a
module global named 'DONE_STRING_DEFAULT', with a new optional flag
parameter to publish() called 'done_string'.

The only behavioral change, if you don't pass in a done_string, is
that the string is printed to stderr instead of 'print'ed to stdout.



=== Zope/lib/python/ZPublisher/Test.py 1.40.66.4 => 1.40.66.5 ===
--- Zope/lib/python/ZPublisher/Test.py:1.40.66.4	Thu Mar 11 20:23:33 2004
+++ Zope/lib/python/ZPublisher/Test.py	Thu Mar 25 11:53:56 2004
@@ -94,6 +94,8 @@
 '''
 __version__='$Revision$'[11:-2]
 
+DONE_STRING_DEFAULT = '\n%s\n\n' % ('_'*60)
+
 import sys, traceback, profile, os, getopt
 from time import clock
 repeat_count=100
@@ -244,7 +246,7 @@
 def publish(script=None,path_info='/',
             u=None,p=None,d=None,t=None,e=None,s=None,pm=0,
             extra=None, request_method='GET',
-            fp=None,
+            fp=None, done_string=DONE_STRING_DEFAULT,
             stdin=sys.stdin):
 
     profile=p
@@ -374,7 +376,7 @@
     elif pm:
         stdout=sys.stdout
         publish_module_pm(file, environ=env, stdout=stdout, extra=extra)
-        print '\n%s\n' % ('_'*60)
+        sys.stderr.write(done_string)
     else:
         if silent:
             stdout=open('/dev/null','w')
@@ -386,6 +388,6 @@
 
         publish_module(file, environ=env, stdin=stdin,
                        stdout=stdout, extra=extra)
-        print '\n%s\n' % ('_'*60)
+        sys.stderr.write(done_string)
 
 if __name__ == "__main__": main()




More information about the Zope-Checkins mailing list