[Checkins] SVN: Products.ZCatalog/trunk/src/Products/ZCatalog/ProgressHandler.py slightly modernize progress handler

Hano Schlichting cvs-admin at zope.org
Sat Apr 7 12:22:15 UTC 2012


Log message for revision 125064:
  slightly modernize progress handler
  

Changed:
  U   Products.ZCatalog/trunk/src/Products/ZCatalog/ProgressHandler.py

-=-
Modified: Products.ZCatalog/trunk/src/Products/ZCatalog/ProgressHandler.py
===================================================================
--- Products.ZCatalog/trunk/src/Products/ZCatalog/ProgressHandler.py	2012-04-07 12:18:56 UTC (rev 125063)
+++ Products.ZCatalog/trunk/src/Products/ZCatalog/ProgressHandler.py	2012-04-07 12:22:12 UTC (rev 125064)
@@ -43,7 +43,7 @@
 
     def finish(self):
         self.output('Process terminated. Duration: %0.2f seconds' % \
-                    (time.time() -self._start))
+                    (time.time() - self._start))
 
     def report(self, current, *args, **kw):
         if current > 0:
@@ -57,7 +57,7 @@
                             end.strftime('%Y/%m/%d %H:%M:%Sh')))
 
     def output(self, text):
-        print >>self.fp, '%s: %s' % (self._ident, text)
+        print >> self.fp, '%s: %s' % (self._ident, text)
 
 
 class ZLogHandler(StdoutHandler):
@@ -75,4 +75,5 @@
         self.filename = filename
 
     def output(self, text):
-        open(self.filename, 'a').write(text + '\n')
+        with open(self.filename, 'a') as fd:
+            fd.write(text + '\n')



More information about the checkins mailing list