Commit 83515e21 authored by Nicolas Delaby's avatar Nicolas Delaby

Various small improvement:

 * get portal_workflow from portal itself
 * use ElementTree API
 * coding style
 * remove support of CPS 


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35825 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 202812e0
...@@ -954,8 +954,8 @@ class ERP5Conduit(XMLSyncUtilsMixin): ...@@ -954,8 +954,8 @@ class ERP5Conduit(XMLSyncUtilsMixin):
""" """
conflict_list = [] conflict_list = []
# We want to add a workflow action # We want to add a workflow action
wf_tool = getToolByName(object,'portal_workflow') wf_tool = getToolByName(object.getPortalObject(), 'portal_workflow')
wf_id = self.getAttribute(xml,'id') wf_id = xml.get('id')
if wf_id is None: # History added by xupdate if wf_id is None: # History added by xupdate
wf_id = self.getHistoryIdFromSelect(xml) wf_id = self.getHistoryIdFromSelect(xml)
xml = xml[0] xml = xml[0]
...@@ -966,19 +966,7 @@ class ERP5Conduit(XMLSyncUtilsMixin): ...@@ -966,19 +966,7 @@ class ERP5Conduit(XMLSyncUtilsMixin):
status=status,wf_tool=wf_tool, status=status,wf_tool=wf_tool,
wf_id=wf_id,xml=xml) wf_id=wf_id,xml=xml)
if add_action and not simulate: if add_action and not simulate:
wf_tool.setStatusOf(wf_id,object,status) wf_tool.setStatusOf(wf_id, object, status)
# Specific CPS, try to remove duplicate lines in portal_repository._histories
tool = getToolByName(self,'portal_repository',None)
if tool is not None:
if getattr(self, 'getDocid', None) is not None:
docid = self.getDocid()
history = tool.getHistory(docid)
new_history = ()
for history_line in history:
if history_line not in new_history:
new_history += (history_line,)
tool.setHistory(docid,new_history)
return conflict_list return conflict_list
...@@ -990,9 +978,9 @@ class ERP5Conduit(XMLSyncUtilsMixin): ...@@ -990,9 +978,9 @@ class ERP5Conduit(XMLSyncUtilsMixin):
""" """
# We want to add a local role # We want to add a local role
roles = self.convertXmlValue(xml, data_type='tokens') roles = self.convertXmlValue(xml, data_type='tokens')
user = self.getAttribute(xml, 'id') user = xml.get('id')
roles = list(roles) # Needed for CPS, or we have a CPS error #LOG('local_role: %s' % object.getPath(), INFO,
#LOG('local_role: ',0,'user: %s roles: %s' % (repr(user),repr(roles))) #'user:%r | roles:%r' % (user, roles))
#user = roles[0] #user = roles[0]
#roles = roles[1:] #roles = roles[1:]
if xml.xpath('local-name()') == self.local_role_tag: if xml.xpath('local-name()') == self.local_role_tag:
......
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