Skip to content

Commit

Permalink
slightly modernize progress handler
Browse files Browse the repository at this point in the history
  • Loading branch information
hannosch committed Apr 7, 2012
1 parent 7404b58 commit 7e8ba2e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Products/ZCatalog/ProgressHandler.py
Expand Up @@ -43,7 +43,7 @@ def info(self, text):

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:
Expand All @@ -57,7 +57,7 @@ def report(self, current, *args, **kw):
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):
Expand All @@ -75,4 +75,5 @@ def __init__(self, filename, steps=100):
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')

0 comments on commit 7e8ba2e

Please sign in to comment.