Commit 02750438 authored by Jérome Perrin's avatar Jérome Perrin

officejs_support_request_ui: py3

parent a9bcdeff
......@@ -2,6 +2,7 @@
This script has proxy role, as only manager can access workflow configuration.
"""
import six
from Products.ERP5Type.Message import translateString
portal = context.getPortalObject()
......@@ -11,9 +12,9 @@ workflow = portal.portal_workflow.ticket_workflow
for state in workflow.getStateValueList():
state_title = state.title_or_id()
state_title = unicode(translateString(
state_title = six.text_type(translateString(
'%s [state in %s]' % (state_title, workflow.getId()),
default=unicode(translateString(state_title))))
default=six.text_type(translateString(state_title))))
info[state.getReference()] = state_title
return info
......@@ -28,9 +28,9 @@ for worklist in workflow.getWorklistValueList():
# so that it looks good in the module view.
key = 'translated_%s_title' % key
state_title = workflow.getStateValueByReference(value[0]).title_or_id()
value = unicode(translateString(
value = six.text_type(translateString(
'%s [state in %s]' % (state_title, workflow.getId()),
default=unicode(translateString(state_title))))
default=six.text_type(translateString(state_title))))
if isinstance(value, (tuple, list)):
query_list.extend([{
......
......@@ -4,8 +4,8 @@ support_request = context.getFollowUpValue()
web_site_value = portal.restrictedTraverse(web_site_relative_url)
# XXX what to do with PData ?
# As a first step just use a string.
data = str(context.getData())
# As a first step just use bytes.
data = bytes(context.getData())
is_html = context.getPortalType() == 'HTML Post'
if is_html:
......@@ -34,7 +34,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,
text_content=data.decode('utf-8'),
follow_up_value=support_request,
aggregate_value_list=[context] + context.getSuccessorValueList(
portal_type=portal.getPortalDocumentTypeList()),
......
# return worklists from ticket workflow in JSON format
from Products.ERP5Type.Message import translateString
import json
import six
portal = context.getPortalObject()
worklist_query_dict = portal.ERP5Site_getTicketWorkflowWorklistInfoDict(
......@@ -11,7 +12,7 @@ worklist_query_dict = portal.ERP5Site_getTicketWorkflowWorklistInfoDict(
# extend this information with the query from our helper script.
worklist_action_list = [
{
'action_name': unicode(translateString(action['name'].rsplit(' (', 1)[0])), # Action name include the count, but we display it separatly.
'action_name': six.text_type(translateString(action['name'].rsplit(' (', 1)[0])), # Action name include the count, but we display it separatly.
'action_count': action['count'],
'query': worklist_query_dict[action['worklist_id']],
}
......
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