Commit 36658131 authored by Aurel's avatar Aurel

merge code between ConsistencyMessage and ObjectMessage class


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11244 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent beecc253
......@@ -27,13 +27,16 @@
##############################################################################
from Products.PythonScripts.Utility import allow_class
from Products.ERP5Type.ObjectMessage import ObjectMessage
class ConsistencyMessage:
class ConsistencyMessage(ObjectMessage):
"""
Object Message is used for notifications to user.
Consistency Message is used for notifications to user after checkConsistency.
"""
def __init__(self, constraint, object_relative_url='', message='', mapping = {}, **kw):
"""
init specific variable to constraint
"""
self.object_relative_url = object_relative_url
self.message = message
self.mapping = mapping
......@@ -64,14 +67,4 @@ class ConsistencyMessage:
"""
pass
def getTranslatedMessage(self):
"""
Return the message translated
"""
from Products.ERP5Type.Message import Message
return Message(domain='erp5_ui', message=self.message, mapping=self.mapping)
getMessage = getTranslatedMessage
allow_class(ConsistencyMessage)
......@@ -26,19 +26,18 @@
#
##############################################################################
from Products.ERP5Type.Message import Message
from Products.CMFCore.utils import getToolByName
from Products.PythonScripts.Utility import allow_class
from Globals import get_request
class ObjectMessage:
"""
Object Message is used for notifications to user.
"""
def __init__(self, object_relative_url='', message='', **kw):
def __init__(self, object_relative_url='', message='', mapping={}, **kw):
self.object_relative_url = object_relative_url
self.message = message
self.mapping = mapping
self.__dict__.update(kw)
......@@ -46,13 +45,10 @@ class ObjectMessage:
"""
Return the message translated
"""
return Message(domain='erp5_ui', message=self.message)
from Products.ERP5Type.Message import Message
return Message(domain='erp5_ui', message=self.message, mapping=self.mapping)
def getMessage(self):
"""
Return the message without translation
"""
return self.message
getMessage = getTranslatedMessage
def edit(self, **kw):
"""
......@@ -70,6 +66,7 @@ class ObjectMessage:
"""
Get the Object
"""
from Globals import get_request
request = get_request()['PARENTS']
if request is not None:
for item in request:
......
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