Commit ef5d6d9c authored by Julien Muchembled's avatar Julien Muchembled

CMFActivity: cleanup ActiveResult

parent 661d5ca9
...@@ -26,10 +26,8 @@ ...@@ -26,10 +26,8 @@
# #
############################################################################## ##############################################################################
from Products.ERP5Type.Base import Base
from Products.ERP5Type.Utils import getPath from Products.ERP5Type.Utils import getPath
from zLOG import LOG from zLOG import LOG, INFO
from Products.ERP5Type.Globals import InitializeClass, DTMLFile
from Products.PythonScripts.Utility import allow_class from Products.PythonScripts.Utility import allow_class
class ActiveResult: class ActiveResult:
...@@ -39,40 +37,24 @@ class ActiveResult: ...@@ -39,40 +37,24 @@ class ActiveResult:
(and eventually, errors) (and eventually, errors)
""" """
# Standard severities
TRACE = -300
DEBUG = -200
BLATHER = -100
INFO = 0
PROBLEM = 100
WARNING = 100
ERROR = 200
PANIC = 300
# getProperty default
_MARKER = None
def __init__(self, summary='', severity=INFO, detail='', **kw): def __init__(self, summary='', severity=INFO, detail='', **kw):
""" """
set all parameters set all parameters
""" """
if kw.has_key('object_path'):
self.object_path = getPath(kw['object_path'],tuple=1)
del kw['object_path']
self.summary = summary self.summary = summary
self.severity = severity self.severity = severity
self.detail = detail self.detail = detail
self.__dict__.update(kw) self.edit(**kw)
def edit(self,**kw): def edit(self,**kw):
""" """
set all parameters set all parameters
""" """
if kw.has_key('object_path'): if 'object_path' in kw:
self.object_path = getPath(kw['object_path'],tuple=1) self.object_path = getPath(kw.pop('object_path'), tuple=1)
del kw['object_path']
self.__dict__.update(kw) self.__dict__.update(kw)
def getProperty(self,value,d=_MARKER,**kw): def getProperty(self, value, d=None):
""" """
A simple getter A simple getter
""" """
...@@ -88,13 +70,13 @@ class ActiveResult: ...@@ -88,13 +70,13 @@ class ActiveResult:
""" """
Tells if the result is a result or an error Tells if the result is a result or an error
""" """
return self.severity <= self.INFO return self.severity <= INFO
def isError(self): def isError(self):
""" """
Tells if the result is a result or an error Tells if the result is a result or an error
""" """
return self.severity > self.INFO return self.severity > INFO
allow_class(ActiveResult) allow_class(ActiveResult)
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