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

officejs_support_request_ui: py3

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