Commit f28785af authored by Nicolas Delaby's avatar Nicolas Delaby

boolean cleanup

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35814 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 91623c03
...@@ -122,8 +122,8 @@ class ERP5Conduit(XMLSyncUtilsMixin): ...@@ -122,8 +122,8 @@ class ERP5Conduit(XMLSyncUtilsMixin):
[conflict1,conflict2,...] where conclict1 is of the form : [conflict1,conflict2,...] where conclict1 is of the form :
[object.getPath(),keyword,local_and_actual_value,subscriber_value] [object.getPath(),keyword,local_and_actual_value,subscriber_value]
""" """
reset_local_roles = 0 reset_local_roles = False
reset_workflow = 0 reset_workflow = False
conflict_list = [] conflict_list = []
xml = self.convertToXml(xml) xml = self.convertToXml(xml)
#LOG('ERP5Conduit addNode:',DEBUG,etree.tostring(xml,pretty_print=True)) #LOG('ERP5Conduit addNode:',DEBUG,etree.tostring(xml,pretty_print=True))
...@@ -330,7 +330,7 @@ class ERP5Conduit(XMLSyncUtilsMixin): ...@@ -330,7 +330,7 @@ class ERP5Conduit(XMLSyncUtilsMixin):
# - old_data : the data from this box but at the time of the i # - old_data : the data from this box but at the time of the i
#last synchronization #last synchronization
# - current_data : the data actually on this box # - current_data : the data actually on this box
isConflict = 0 isConflict = False
if (previous_xml is not None) and (not force): if (previous_xml is not None) and (not force):
# if no previous_xml, no conflict # if no previous_xml, no conflict
old_data = self.getObjectProperty(keyword, previous_xml, old_data = self.getObjectProperty(keyword, previous_xml,
...@@ -454,7 +454,7 @@ class ERP5Conduit(XMLSyncUtilsMixin): ...@@ -454,7 +454,7 @@ class ERP5Conduit(XMLSyncUtilsMixin):
msg = MIMEBase('application','octet-stream') msg = MIMEBase('application','octet-stream')
Encoders.encode_base64(msg) Encoders.encode_base64(msg)
msg.set_payload(data) msg.set_payload(data)
data = msg.get_payload(decode=1) data = msg.get_payload(decode=True)
new_args[keyword] = data new_args[keyword] = data
return new_args return new_args
...@@ -469,8 +469,8 @@ class ERP5Conduit(XMLSyncUtilsMixin): ...@@ -469,8 +469,8 @@ class ERP5Conduit(XMLSyncUtilsMixin):
if value is not None: if value is not None:
for bad_string in bad_list: for bad_string in bad_list:
if bad_string.search(value) is not None: if bad_string.search(value) is not None:
return 0 return False
return 1 return True
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getSubObjectXupdate') 'getSubObjectXupdate')
...@@ -731,7 +731,7 @@ class ERP5Conduit(XMLSyncUtilsMixin): ...@@ -731,7 +731,7 @@ class ERP5Conduit(XMLSyncUtilsMixin):
keyword = subnode.xpath('name()') keyword = subnode.xpath('name()')
args[keyword] = self.convertXmlValue(subnode, keyword_type) args[keyword] = self.convertXmlValue(subnode, keyword_type)
elif subnode.xpath('local-name()') in self.ADDABLE_PROPERTY + (self.xml_object_tag,): elif subnode.xpath('local-name()') in self.ADDABLE_PROPERTY + (self.xml_object_tag,):
self.addNode(object=object, xml=subnode, force=1) self.addNode(object=object, xml=subnode, force=True)
# We should first edit the object # We should first edit the object
args = self.getFormatedArgs(args=args) args = self.getFormatedArgs(args=args)
# edit the object with a dictionnary of arguments, # edit the object with a dictionnary of arguments,
...@@ -913,15 +913,15 @@ class ERP5Conduit(XMLSyncUtilsMixin): ...@@ -913,15 +913,15 @@ class ERP5Conduit(XMLSyncUtilsMixin):
if wf_history.has_key(wf_id): if wf_history.has_key(wf_id):
action_list = wf_history[wf_id] action_list = wf_history[wf_id]
else: action_list = [] else: action_list = []
addable = 1 addable = True
for action in action_list: for action in action_list:
this_one = 1 this_one = True
for key in action.keys(): for key in action.keys():
if status[key] != action[key]: if status[key] != action[key]:
this_one = 0 this_one = False
break break
if this_one: if this_one:
addable = 0 addable = False
break break
return addable return addable
...@@ -935,7 +935,7 @@ class ERP5Conduit(XMLSyncUtilsMixin): ...@@ -935,7 +935,7 @@ class ERP5Conduit(XMLSyncUtilsMixin):
#LOG('ERP5Conduit.addNode',0,'portal_type: |%s|' % str(portal_type)) #LOG('ERP5Conduit.addNode',0,'portal_type: |%s|' % str(portal_type))
object.newContent(portal_type=portal_type, id=object_id) object.newContent(portal_type=portal_type, id=object_id)
subobject = object._getOb(object_id) subobject = object._getOb(object_id)
return subobject, 1, 1 return subobject, True, True
security.declareProtected(Permissions.ModifyPortalContent, 'addWorkflowNode') security.declareProtected(Permissions.ModifyPortalContent, 'addWorkflowNode')
def addWorkflowNode(self, object, xml, simulate): def addWorkflowNode(self, object, xml, simulate):
......
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