Commit 792143c2 authored by Carlos Ramos Carreño's avatar Carlos Ramos Carreño Committed by Jérome Perrin

Review/fix diff and passed all tests locally.

parent ac8ce4d3
import json
import base64
from erp5.component.module.Log import log
from Products.ERP5Type.Utils import bytes2str, str2bytes
def getElementFromContent(key, content):
before_template = '"%s" type="text/x-renderjs-configuration">'
......@@ -69,22 +70,22 @@ try:
configuration_path_list = []
for key in portal_actions_dict:
path = "portal_types/%s" % key
configuration_path_list.append(base64.b64encode(path.encode()).decode())
configuration_path_list.append(bytes2str(base64.b64encode(str2bytes(path))))
for action in portal_actions_dict[key]:
path = "portal_types/%s/%s" % (key, action)
configuration_path_list.append(base64.b64encode(path.encode()).decode())
configuration_path_list.append(bytes2str(base64.b64encode(str2bytes(path))))
try:
action_object = context.restrictedTraverse(path)
form = action_object.getActionText().split('/')[-1]
path = "portal_skins/%s/%s" % (portal_skin, form)
configuration_path_list.append(base64.b64encode(path.encode()).decode())
configuration_path_list.append(bytes2str(base64.b64encode(str2bytes(path))))
except KeyError as e:
raise KeyError("Error getting portal action info: " + str(e))
if new_dialog_form_list:
for form in new_dialog_form_list:
path = "portal_skins/%s/%s" % (portal_skin, form)
configuration_path_list.append(base64.b64encode(path.encode()).decode())
configuration_path_list.append(bytes2str(base64.b64encode(str2bytes(path))))
url_list = []
for path in configuration_path_list:
......
from Products.ERP5Type.Message import translateString
from Products.ERP5Type.Utils import bytes2str
portal = context.getPortalObject()
support_request = context.getFollowUpValue()
web_site_value = portal.restrictedTraverse(web_site_relative_url)
......@@ -34,7 +35,7 @@ web_message = portal.event_module.newContent(
portal_type='Web Message',
title=context.getTitle() if context.hasTitle() else None,
content_type='text/html' if is_html else 'text/plain',
text_content=data.decode('utf-8'),
text_content=bytes2str(data),
follow_up_value=support_request,
aggregate_value_list=[context] + context.getSuccessorValueList(
portal_type=portal.getPortalDocumentTypeList()),
......
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