Commit 77525bb0 authored by Hanno Schlichting's avatar Hanno Schlichting

Move IProgressHandler to interfaces module

parent 3641553d
...@@ -16,39 +16,11 @@ import time ...@@ -16,39 +16,11 @@ import time
from logging import getLogger from logging import getLogger
from DateTime.DateTime import DateTime from DateTime.DateTime import DateTime
from zope.interface import Interface
from zope.interface import implements from zope.interface import implements
LOG = getLogger('ProgressHandler') from .interfaces import IProgressHandler
class IProgressHandler(Interface):
""" A handler to log progress informations for long running
operations.
"""
def init(ident, max):
""" Called at the start of the long running process.
'ident' -- a string identifying the operation
'max' -- maximum number of objects to be processed (int)
"""
def info(text): LOG = getLogger('ProgressHandler')
""" Log some 'text'"""
def finish():
""" Called up termination """
def report(current, *args, **kw):
""" Called for every iteration.
'current' -- an integer representing the number of objects
processed so far.
"""
def output(text):
""" Log 'text' to some output channel """
class StdoutHandler: class StdoutHandler:
......
...@@ -281,3 +281,31 @@ class ICatalogBrain(Interface): ...@@ -281,3 +281,31 @@ class ICatalogBrain(Interface):
def getRID(): def getRID():
"""Return the record ID for this object.""" """Return the record ID for this object."""
class IProgressHandler(Interface):
""" A handler to log progress informations for long running
operations.
"""
def init(ident, max):
""" Called at the start of the long running process.
'ident' -- a string identifying the operation
'max' -- maximum number of objects to be processed (int)
"""
def info(text):
""" Log some 'text'"""
def finish():
""" Called up termination """
def report(current, *args, **kw):
""" Called for every iteration.
'current' -- an integer representing the number of objects
processed so far.
"""
def output(text):
""" Log 'text' to some output channel """
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment