Back to index

plone3  3.1.7
broken.py
Go to the documentation of this file.
00001 from Products.PortalTransforms.interfaces import itransform
00002 from Products.PortalTransforms.utils import log
00003 WARNING=100
00004 
00005 class BrokenTransform:
00006     __implements__ = itransform
00007 
00008     __name__ = "broken transform"
00009     inputs  = ("BROKEN",)
00010     output = "BROKEN"
00011     
00012     def __init__(self, id, module, error):
00013         self.id = id
00014         self.module = module
00015         self.error = error
00016 
00017     def name(self):
00018         return self.__name__
00019 
00020     def convert(self, orig, data, **kwargs):
00021         # do the format
00022         msg = "Calling convert on BROKEN transform %s (%s). Error: %s" % \
00023               (self.id, self.module, self.error)
00024         log(msg, severity=WARNING)
00025         print msg
00026         data.setData('')
00027         return data
00028 
00029 def register():
00030     return broken()