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

crm: pylint on py3

parent b8aee3f3
......@@ -92,11 +92,7 @@ for r_event in event_list:
unassigned_dic[event.getSimulationState()]=unassigned_dic[event.getSimulationState()]+1
unassigned_dic['total']=unassigned_dic['total']+1
#Sort the result and add unassigned
def comparator(x, y):
if x['ticket_type'] == y['ticket_type']:
return cmp(x['ticket_title'], y['ticket_title'])
return cmp(x['ticket_type'], y['ticket_type'])
column_list.sort(comparator)
column_list.sort(key=lambda x: (x['ticket_type'], x['ticket_title']))
if unassigned_dic['total']>0: column_list.append(unassigned_dic)
#fill line_list that is returned to report
line_list = []
......
import six
text = context.asText()
LENGTH = 25
#TODO: Think about the display length of multibyte characters.
# TODO: Think about the display length of multibyte characters.
if six.PY3:
return text[:LENGTH]
try:
return unicode(text, 'utf-8')[:LENGTH].encode('utf-8')
return six.text_type(text, 'utf-8')[:LENGTH].encode('utf-8')
except UnicodeDecodeError:
return text[:LENGTH]
......@@ -49,7 +49,7 @@ for r_ticket in ticket_list:
for r_event_causality in event_causality_list:
event_causality = r_event_causality.getObject()
#check that one event it isn't related by causality and follow-up with the same ticket
if ticket.getUid() <> event_causality.getFollowUpUid():
if ticket.getUid() != event_causality.getFollowUpUid():
line_list.append(Object(uid='new_',
ticket='',
type=event_causality.getTranslatedPortalType(),
......
......@@ -111,36 +111,17 @@ class CrmTestCase(ERP5ReportTestCase):
if simulation_state == 'assigned':
raise NotImplementedError('%r state only exists in the old event workflow.' % simulation_state)
"""
ticket=self.portal.restrictedTraverse(ev.getFollowUp())
self._doWorkflowAction(ev,'assign_action',
follow_up_ticket_type = ticket.getPortalType(),
follow_up_ticket_title = ticket.getTitle())
"""
elif simulation_state == 'planned':
ev.plan()
elif simulation_state == 'posted':
raise NotImplementedError('%r state only exists in the old event workflow.' % simulation_state)
"""
ev.start()
"""
elif simulation_state == 'delivered':
ev.start()
ev.deliver()
elif simulation_state == 'new':
raise NotImplementedError('%r state only exists in the old event workflow.' % simulation_state)
"""
ev.receive()
"""
elif simulation_state == 'acknowledged':
raise NotImplementedError('%r state only exists in the old event workflow.' % simulation_state)
"""
ticket=self.portal.restrictedTraverse(ev.getFollowUp())
self._doWorkflowAction(ev,'assign_action',
follow_up_ticket_type = ticket.getPortalType(),
follow_up_ticket_title = ticket.getTitle())
self._doWorkflowAction(ev, 'acknowledge_action')
"""
elif simulation_state == 'cancelled':
ev.stop()
ev.cancel()
......@@ -148,24 +129,12 @@ class CrmTestCase(ERP5ReportTestCase):
ev.delete()
elif simulation_state == 'expired':
raise NotImplementedError('%r state only exists in the old event workflow.' % simulation_state)
"""
ev.receive()
ev.expire()
"""
elif simulation_state == 'responded':
raise NotImplementedError('%r state only exists in the old event workflow.' % simulation_state)
"""
ev.receive()
ev.respond()
"""
elif simulation_state == 'started':
ev.start()
elif simulation_state == 'ordered':
raise NotImplementedError('%r state only exists in the old event workflow.' % simulation_state)
"""
ev.plan()
ev.order()
"""
elif simulation_state == 'stopped':
ev.stop()
# sanity check
......
......@@ -162,12 +162,10 @@ class TestEditorField(ERP5TypeTestCase, ZopeTestCase.Functional):
if html_text.find(match_string1) == -1:
print(html_text)
print(match_string1)
import pdb; pdb.set_trace()
return False
if html_text.find(match_string2) == -1:
print(html_text)
print(match_string2)
import pdb; pdb.set_trace()
return False
return True
......
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