Commit e891a01b authored by Nicolas Delaby's avatar Nicolas Delaby

hide logs

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14702 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4997ff4e
......@@ -139,7 +139,7 @@ class ERP5Conduit(XMLSyncUtilsMixin):
xml = self.convertToXml(xml)
if xml is None:
return {'conflict_list':conflict_list, 'object':sub_object}
LOG('addNode',0,'xml_reconstitued: %s' % str(xml))
#LOG('addNode',0,'xml_reconstitued: %s' % str(xml))
# In the case where this new node is a object to add
if xml.nodeName in self.XUPDATE_INSERT_OR_ADD and \
self.getSubObjectDepth(xml)==0:
......@@ -153,7 +153,7 @@ class ERP5Conduit(XMLSyncUtilsMixin):
if object_id is None:
object_id = self.getAttribute(xml,'id')
docid = self.getObjectDocid(xml)
LOG('addNode',0,'object_id: %s' % object_id)
#LOG('addNode',0,'object_id: %s' % object_id)
if object_id is not None:
if sub_object is None:
try:
......@@ -181,12 +181,12 @@ class ERP5Conduit(XMLSyncUtilsMixin):
elif xml.nodeName in self.XUPDATE_INSERT_OR_ADD \
and self.getSubObjectDepth(xml)>=1:
sub_object_id = self.getSubObjectId(xml)
LOG('addNode',0,'getSubObjectModification number: %s' % sub_object_id)
#LOG('addNode',0,'getSubObjectModification number: %s' % sub_object_id)
if previous_xml is not None and sub_object_id is not None:
LOG('addNode',0,'previous xml is not none and also sub_object_id')
#LOG('addNode',0,'previous xml is not none and also sub_object_id')
# Find the previous xml corresponding to this subobject
sub_previous_xml = self.getSubObjectXml(sub_object_id,previous_xml)
LOG('addNode',0,'isSubObjectModification sub_p_xml: %s' % str(sub_previous_xml))
#LOG('addNode',0,'isSubObjectModification sub_p_xml: %s' % str(sub_previous_xml))
if sub_previous_xml is not None:
sub_object = None
try:
......@@ -194,11 +194,11 @@ class ERP5Conduit(XMLSyncUtilsMixin):
except (AttributeError, KeyError, TypeError):
pass
if sub_object is not None:
LOG('addNode',0,'subobject.id: %s' % sub_object.id)
#LOG('addNode',0,'subobject.id: %s' % sub_object.id)
# Change the xml in order to directly apply
# modifications to the subobject
sub_xml = self.getSubObjectXupdate(xml)
LOG('addNode',0,'sub_xml: %s' % str(sub_xml))
#LOG('addNode',0,'sub_xml: %s' % str(sub_xml))
# Then do the udpate
conflict_list += self.addNode(xml=sub_xml,object=sub_object,
previous_xml=sub_previous_xml, force=force,
......@@ -223,14 +223,14 @@ class ERP5Conduit(XMLSyncUtilsMixin):
A node is deleted
"""
# In the case where we have to delete an object
LOG('ERP5Conduit',0,'deleteNode')
LOG('ERP5Conduit',0,'deleteNode, object.id: %s' % object.getId())
LOG('ERP5Conduit',0,'deleteNode, object path: %s' % repr(object.getPhysicalPath()))
#LOG('ERP5Conduit',0,'deleteNode')
#LOG('ERP5Conduit',0,'deleteNode, object.id: %s' % object.getId())
#LOG('ERP5Conduit',0,'deleteNode, object path: %s' % repr(object.getPhysicalPath()))
conflict_list = []
if xml is not None:
xml = self.convertToXml(xml)
if object_id is None:
LOG('ERP5Conduit',0,'deleteNode, SubObjectDepth: %i' % self.getSubObjectDepth(xml))
#LOG('ERP5Conduit',0,'deleteNode, SubObjectDepth: %i' % self.getSubObjectDepth(xml))
if xml.nodeName == self.xml_object_tag:
object_id = self.getAttribute(xml,'id')
elif self.getSubObjectDepth(xml)==1:
......@@ -244,13 +244,13 @@ class ERP5Conduit(XMLSyncUtilsMixin):
conflict_list += self.deleteNode(xml=sub_xml,object=sub_object,
force=force, simulate=simulate, **kw)
except (KeyError, AttributeError, TypeError):
LOG('ERP5Conduit',0,'deleteNode, Unable to delete SubObject: %s' % str(sub_object_id))
#LOG('ERP5Conduit',0,'deleteNode, Unable to delete SubObject: %s' % str(sub_object_id))
pass
if object_id is not None: # We do have an object_id
try:
object._delObject(object_id)
except (AttributeError, KeyError):
LOG('ERP5Conduit',0,'deleteNode, Unable to delete: %s' % str(object_id))
#LOG('ERP5Conduit',0,'deleteNode, Unable to delete: %s' % str(object_id))
pass
# In the case where we have to delete an user role
# If we are still there, this means the delete is for this node
......@@ -259,7 +259,7 @@ class ERP5Conduit(XMLSyncUtilsMixin):
if xml.nodeName in self.local_role_list and not simulate:
# We want to del a local role
user = self.getAttribute(xml,'id')
LOG('local_role: ',0,'user: %s' % repr(user))
#LOG('local_role: ',0,'user: %s' % repr(user))
if xml.nodeName.find(self.local_role_tag)>=0:
object.manage_delLocalRoles([user])
elif xml.nodeName.find(self.local_group_tag)>=0:
......@@ -281,8 +281,8 @@ class ERP5Conduit(XMLSyncUtilsMixin):
"""
conflict_list = []
xml = self.convertToXml(xml)
LOG('updateNode',0,'xml.nodeName: %s' % xml.nodeName)
LOG('updateNode, force: ',0,force)
#LOG('updateNode',0,'xml.nodeName: %s' % xml.nodeName)
#LOG('updateNode, force: ',0,force)
# we have an xupdate xml
if xml.nodeName == 'xupdate:modifications':
conflict_list += self.applyXupdate(object=object, xupdate=xml,
......@@ -291,12 +291,12 @@ class ERP5Conduit(XMLSyncUtilsMixin):
# we may have only the part of an xupdate
else:
args = {}
LOG('isSubObjectModification',0,'result: %s' % str(self.isSubObjectModification(xml)))
#LOG('isSubObjectModification',0,'result: %s' % str(self.isSubObjectModification(xml)))
if self.isProperty(xml) and not(self.isSubObjectModification(xml)):
keyword = None
for subnode in self.getAttributeNodeList(xml):
if subnode.nodeName=='select':
LOG('updateNode',0,'selection: %s' % str(subnode.nodeValue))
#LOG('updateNode',0,'selection: %s' % str(subnode.nodeValue))
select_list = subnode.nodeValue.split('/') # Something like:
#('','object[1]','sid[1]')
new_select_list = ()
......@@ -308,7 +308,7 @@ class ERP5Conduit(XMLSyncUtilsMixin):
keyword = select_list[len(select_list)-1] # this will be 'sid'
data_xml = xml
data = None
LOG('updateNode',0,'keyword: %s' % str(keyword))
#LOG('updateNode',0,'keyword: %s' % str(keyword))
if xml.nodeName not in self.XUPDATE_INSERT_OR_ADD:
for subnode in self.getElementNodeList(xml):
if subnode.nodeName=='xupdate:element':
......@@ -342,7 +342,7 @@ class ERP5Conduit(XMLSyncUtilsMixin):
if not (keyword in self.NOT_EDITABLE_PROPERTY):
# We will look for the data to enter
data_type = object.getPropertyType(keyword)
LOG('updateNode',0,'data_type: %s' % str(data_type))
#LOG('updateNode',0,'data_type: %s' % str(data_type))
data = self.convertXmlValue(data,data_type=data_type)
args[keyword] = data
args = self.getFormatedArgs(args=args)
......@@ -357,12 +357,12 @@ class ERP5Conduit(XMLSyncUtilsMixin):
data_type=data_type)
#current_data = object.getProperty(keyword)
current_data = self.getProperty(object, keyword)
LOG('updateNode',0,'Conflict data: %s' % str(data))
LOG('updateNode',0,'Conflict old_data: %s' % str(old_data))
LOG('updateNode',0,'Conflict current_data: %s' % str(current_data))
#LOG('updateNode',0,'Conflict data: %s' % str(data))
#LOG('updateNode',0,'Conflict old_data: %s' % str(old_data))
#LOG('updateNode',0,'Conflict current_data: %s' % str(current_data))
if (old_data != current_data) and (data != current_data) \
and keyword not in self.force_conflict_list:
LOG('updateNode',0,'Conflict on : %s' % keyword)
#LOG('updateNode',0,'Conflict on : %s' % keyword)
# Hack in order to get the synchronization working for demo
# XXX this have to be removed after
#if not (data_type in self.binary_type_list):
......@@ -385,7 +385,7 @@ class ERP5Conduit(XMLSyncUtilsMixin):
#subscriber_value=data)] # not needed any more
# We will now apply the argument with the method edit
if args != {} and (isConflict==0 or force) and (not simulate):
LOG('updateNode',0,'object._edit, args: %s' % str(args))
#LOG('updateNode',0,'object._edit, args: %s' % str(args))
#object._edit(**args)
self.editDocument(object=object,**args)
# It is sometimes required to do something after an edit
......@@ -394,17 +394,17 @@ class ERP5Conduit(XMLSyncUtilsMixin):
if keyword == 'object':
# This is the case where we have to call addNode
LOG('updateNode',0,'we will add sub-object')
#LOG('updateNode',0,'we will add sub-object')
conflict_list += self.addNode(xml=xml, object=object, force=force,
simulate=simulate, **kw)['conflict_list']
elif keyword == self.history_tag and not simulate:
# This is the case where we have to call addNode
LOG('updateNode',0,'we will add history')
#LOG('updateNode',0,'we will add history')
conflict_list += self.addNode(xml=subnode,object=object,force=force,
simulate=simulate,**kw)['conflict_list']
elif keyword in (self.local_role_tag,self.local_permission_tag) and not simulate:
# This is the case where we have to update Roles or update permission
LOG('updateNode',0,'we will add a local role')
#LOG('updateNode',0,'we will add a local role')
#user = self.getSubObjectId(xml)
#roles = self.convertXmlValue(data,data_type='tokens')
#object.manage_setLocalRoles(user,roles)
......@@ -415,11 +415,11 @@ class ERP5Conduit(XMLSyncUtilsMixin):
# We should find the object corresponding to
# this update, so we have to look in the previous_xml
sub_object_id = self.getSubObjectId(xml)
LOG('updateNode',0,'isSubObjectModification sub_object_id: %s' % sub_object_id)
#LOG('updateNode',0,'isSubObjectModification sub_object_id: %s' % sub_object_id)
if previous_xml is not None and sub_object_id is not None:
LOG('updateNode',0,'previous xml is not none and also sub_object_id')
#LOG('updateNode',0,'previous xml is not none and also sub_object_id')
sub_previous_xml = self.getSubObjectXml(sub_object_id,previous_xml)
LOG('updateNode',0,'isSubObjectModification sub_p_xml: %s' % str(sub_previous_xml))
#LOG('updateNode',0,'isSubObjectModification sub_p_xml: %s' % str(sub_previous_xml))
if sub_previous_xml is not None:
sub_object = None
try:
......@@ -427,11 +427,11 @@ class ERP5Conduit(XMLSyncUtilsMixin):
except KeyError:
pass
if sub_object is not None:
LOG('updateNode',0,'subobject.id: %s' % sub_object.id)
#LOG('updateNode',0,'subobject.id: %s' % sub_object.id)
# Change the xml in order to directly apply
# modifications to the subobject
sub_xml = self.getSubObjectXupdate(xml)
LOG('updateNode',0,'sub_xml: %s' % str(sub_xml))
#LOG('updateNode',0,'sub_xml: %s' % str(sub_xml))
# Then do the udpate
conflict_list += self.updateNode(xml=sub_xml, object=sub_object, force=force,
previous_xml=sub_previous_xml, simulate=simulate, **kw)
......@@ -470,7 +470,7 @@ class ERP5Conduit(XMLSyncUtilsMixin):
This lookd inside the args dictionnary and then
convert any unicode string to string
"""
LOG('ERP5Conduit.getFormatedArgs',0,'args: %s' % str(args))
#LOG('ERP5Conduit.getFormatedArgs',0,'args: %s' % str(args))
new_args = {}
for keyword in args.keys():
data = args[keyword]
......@@ -488,7 +488,7 @@ class ERP5Conduit(XMLSyncUtilsMixin):
data = data.encode(self.getEncoding())
data = data.replace('@@@','\n')
if keyword == 'binary_data':
LOG('ERP5Conduit.getFormatedArgs',0,'binary_data keyword: %s' % str(keyword))
#LOG('ERP5Conduit.getFormatedArgs',0,'binary_data keyword: %s' % str(keyword))
msg = MIMEBase('application','octet-stream')
Encoders.encode_base64(msg)
msg.set_payload(data)
......@@ -562,17 +562,17 @@ class ERP5Conduit(XMLSyncUtilsMixin):
1 means it is a subobject
2 means it is more depth than subobject
"""
LOG('getSubObjectDepth',0,'xml.nodeName: %s' % xml.nodeName)
#LOG('getSubObjectDepth',0,'xml.nodeName: %s' % xml.nodeName)
if xml.nodeName in self.XUPDATE_TAG:
i = 0
if xml.nodeName in self.XUPDATE_INSERT:
i = 1
LOG('getSubObjectDepth',0,'xml2.nodeName: %s' % xml.nodeName)
#LOG('getSubObjectDepth',0,'xml2.nodeName: %s' % xml.nodeName)
for subnode in self.getAttributeNodeList(xml):
LOG('getSubObjectDepth',0,'subnode.nodeName: %s' % subnode.nodeName)
#LOG('getSubObjectDepth',0,'subnode.nodeName: %s' % subnode.nodeName)
if subnode.nodeName == 'select':
value = subnode.nodeValue
LOG('getSubObjectDepth',0,'subnode.nodeValue: %s' % subnode.nodeValue)
#LOG('getSubObjectDepth',0,'subnode.nodeValue: %s' % subnode.nodeValue)
if re.search(self.sub_sub_object_exp,value) is not None:
return 2 # This is sure in all cases
elif re.search(self.sub_object_exp,value) is not None:
......@@ -700,11 +700,11 @@ class ERP5Conduit(XMLSyncUtilsMixin):
if xml is None:
return
if type(xml) in (type('a'),type(u'a')):
LOG('Conduit.convertToXml xml',0,repr(xml))
#LOG('Conduit.convertToXml xml',0,repr(xml))
if type(xml) is type(u'a'):
xml = xml.encode('utf-8')
xml = Parse(xml)
LOG('Conduit.convertToXml not failed',0,'ok')
#LOG('Conduit.convertToXml not failed',0,'ok')
xml = xml.childNodes[0] # Because we just created a new xml
# If we have the xml from the node erp5, we just take the subnode
if xml.nodeName=='erp5':
......@@ -824,7 +824,7 @@ class ERP5Conduit(XMLSyncUtilsMixin):
for subnode in self.getElementNodeList(xml):
if subnode.nodeName in self.XUPDATE_EL:
e_list += [subnode]
LOG('getXupdateElementList, e_list:',0,e_list)
#LOG('getXupdateElementList, e_list:',0,e_list)
return e_list
security.declareProtected(Permissions.AccessContentsInformation,'getElementFromXupdate')
......@@ -879,7 +879,7 @@ class ERP5Conduit(XMLSyncUtilsMixin):
maxi = xml_string.find('>')+1
result += xml_string[maxi:xml_string.find('</%s>' % xml.nodeName)]
result += '</' + property + '>'
LOG('getElementFromXupdate, result:',0,repr(result))
#LOG('getElementFromXupdate, result:',0,repr(result))
return self.convertToXml(result)
return xml
......@@ -1037,7 +1037,7 @@ class ERP5Conduit(XMLSyncUtilsMixin):
own Conduit.
"""
portal_types = getToolByName(object,'portal_types')
LOG('ERP5Conduit.addNode',0,'portal_type: |%s|' % str(portal_type))
#LOG('ERP5Conduit.addNode',0,'portal_type: |%s|' % str(portal_type))
if docid==None: # ERP5 content
object.newContent(portal_type=portal_type,id=object_id)
else: # CPS content
......@@ -1065,27 +1065,27 @@ class ERP5Conduit(XMLSyncUtilsMixin):
This is really usefull if you want to write your own Conduit.
"""
conflict_list = []
LOG('addNode, workflow_history isHistoryAdd:',0,self.isHistoryAdd(xml))
#LOG('addNode, workflow_history isHistoryAdd:',0,self.isHistoryAdd(xml))
# We want to add a workflow action
wf_tool = getToolByName(object,'portal_workflow')
wf_id = self.getAttribute(xml,'id')
if wf_id is None: # History added by xupdate
wf_id = self.getHistoryIdFromSelect(xml)
LOG('addNode, workflow_history id:',0,wf_id)
#LOG('addNode, workflow_history id:',0,wf_id)
#LOG('addNode, workflow_history xml:',0,xml.toxml())#toxml isn't in 4Suite
LOG('addNode, workflow_history xml.getElmentNodeList:',0,self.getElementNodeList(xml))
#LOG('addNode, workflow_history xml.getElmentNodeList:',0,self.getElementNodeList(xml))
xml = self.getElementNodeList(xml)[0]
LOG('addNode, workflow_history id:',0,wf_id)
LOG('addNode, workflow_history xml:',0,xml)
#LOG('addNode, workflow_history id:',0,wf_id)
#LOG('addNode, workflow_history xml:',0,xml)
#for action in self.getWorkflowActionFromXml(xml):
status = self.getStatusFromXml(xml)
LOG('addNode, status:',0,status)
#LOG('addNode, status:',0,status)
add_action = self.isWorkflowActionAddable(object=object,
status=status,wf_tool=wf_tool,
wf_id=wf_id,xml=xml)
LOG('addNode, workflow_history add_action:',0,add_action)
#LOG('addNode, workflow_history add_action:',0,add_action)
if add_action and not simulate:
LOG('addNode, setting status:',0,'ok')
#LOG('addNode, setting status:',0,'ok')
wf_tool.setStatusOf(wf_id,object,status)
# Specific CPS, try to remove duplicate lines in portal_repository._histories
......
......@@ -533,7 +533,7 @@ class Signature(Folder,SyncCode):
# LOG('delConflict, conflict',0,conflict)
conflict_list = []
for c in self.getConflictList():
LOG('delConflict, c==conflict',0,c==aq_base(conflict))
#LOG('delConflict, c==conflict',0,c==aq_base(conflict))
if c != aq_base(conflict):
conflict_list += [c]
if conflict_list != []:
......@@ -969,7 +969,7 @@ class Subscription(Folder, SyncCode):
# It might be a script python
generator = getattr(object,gid_gen)
o_gid = generator() # XXX - used to be o_gid = generator(object=object) which is redundant
LOG('getGidFromObject',0,'o_gid: %s' % repr(o_gid))
#LOG('getGidFromObject',0,'o_gid: %s' % repr(o_gid))
return o_gid
def getObjectFromGid(self, gid):
......@@ -1043,10 +1043,10 @@ class Subscription(Folder, SyncCode):
generator = getattr(object, id_generator)
new_id = generator()
else:
# This is probably a python scrip
# This is probably a python script
generator = getattr(object, id_generator)
new_id = generator(object=object,gid=gid)
LOG('generateNewId, new_id: ',0,new_id)
#LOG('generateNewId, new_id: ',0,new_id)
return new_id
return None
......@@ -1332,7 +1332,7 @@ class Subscription(Folder, SyncCode):
return b64encode(string_to_encode)
#elif format is .... put here the other formats
else:#if there is no format corresponding with format, raise an error
LOG('encode : unknown or not implemented format :', 0, format)
#LOG('encode : unknown or not implemented format :', 0, format)
raise ValueError, "Sorry, the server ask for the format %s but it's unknow or not implemented" % format
def decode(self, format, string_to_decode):
......@@ -1346,7 +1346,7 @@ class Subscription(Folder, SyncCode):
return b64decode(string_to_decode)
#elif format is .... put here the other formats
else:#if there is no format corresponding with format, raise an error
LOG('decode : unknown or not implemented format :', 0, format)
#LOG('decode : unknown or not implemented format :', 0, format)
raise ValueError, "Sorry, the format %s is unknow or not implemented" % format
def isDecodeEncodeTheSame(self, string_encoded, string_decoded, format):
......
......@@ -39,7 +39,7 @@ class SubscriptionSynchronization(XMLSyncUtils):
"""
Send the first XML message from the client
"""
LOG('SubSyncInit',0,'starting....')
#LOG('SubSyncInit',0,'starting....')
cmd_id = 1 # specifies a SyncML message-unique command identifier
subscription.NewAnchor()
subscription.initLastMessageId()
......@@ -83,8 +83,8 @@ class SubscriptionSynchronization(XMLSyncUtils):
"""
This is the synchronization method for the client
"""
LOG('SubSync',0,'starting... id: %s' % str(id))
LOG('SubSync',0,'starting... msg: %s' % str(msg))
#LOG('SubSync',0,'starting... id: %s' % str(id))
#LOG('SubSync',0,'starting... msg: %s' % str(msg))
response = None #check if subsync replies to this messages
subscription = self.getSubscription(id)
......@@ -132,8 +132,8 @@ class SubscriptionSynchronization(XMLSyncUtils):
This method send crendentials
"""
LOG('SubSyncCred',0,'starting... id: %s' % str(id))
LOG('SubSyncCred',0,'starting... msg: %s' % str(msg))
#LOG('SubSyncCred',0,'starting... id: %s' % str(id))
#LOG('SubSyncCred',0,'starting... msg: %s' % str(msg))
cmd_id = 1 # specifies a SyncML message-unique command identifier
subscription = self.getSubscription(id)
......
......@@ -33,6 +33,7 @@ from DateTime import DateTime
from cStringIO import StringIO
from xml.dom.ext import PrettyPrint
import random
from zLOG import LOG
try:
from Products.CMFActivity.ActiveObject import ActiveObject
except ImportError:
......@@ -40,7 +41,7 @@ except ImportError:
class ActiveObject:
pass
import commands
from zLOG import LOG
try:
from Ft.Xml import Parse
except ImportError:
......@@ -189,7 +190,7 @@ class XMLSyncUtilsMixin(SyncCode):
header = "Subject: %s\n" % id_sync
header += "To: %s\n\n" % toaddr
msg = header + msg
LOG('SubSendMail',0,'from: %s, to: %s' % (fromaddr,toaddr))
#LOG('SubSendMail',0,'from: %s, to: %s' % (fromaddr,toaddr))
server = smtplib.SMTP('localhost')
server.sendmail(fromaddr, toaddr, msg)
# if we want to send the email to someone else (debugging)
......@@ -305,7 +306,7 @@ class XMLSyncUtilsMixin(SyncCode):
xml = xml_method()
else:
raise ValueError, "Sorry the script or method was not found"
LOG('getXMLObject', 0, 'xml_mapping:%s, xml:%s, object:%s xml_method:%s' % (xml_mapping, xml, object, xml_method))
#LOG('getXMLObject', 0, 'xml_mapping:%s, xml:%s, object:%s xml_method:%s' % (xml_mapping, xml, object, xml_method))
return xml
def getSessionId(self, xml):
......@@ -515,7 +516,7 @@ class XMLSyncUtilsMixin(SyncCode):
first_node = xml_stream.childNodes[0]
client_body = first_node.childNodes[3]
if client_body.nodeName != "SyncBody":
LOG('getNextSyncBodyStatus',0,"This is not a SyncML Body")
#LOG('getNextSyncBodyStatus',0,"This is not a SyncML Body")
raise ValueError, "Sorry, This is not a SyncML Body"
next_status = None
found = None
......@@ -810,7 +811,7 @@ class XMLSyncUtilsMixin(SyncCode):
if(subscriber.getMediaType() != self.MEDIA_TYPE['TEXT_XML']):
xml_string = self.getXMLObject(object=object,
xml_mapping=domain.xml_mapping)
LOG('xml_string =', 0, xml_string)
#LOG('xml_string =', 0, xml_string)
if signature.getAction()=='Replace':
syncml_data += self.replaceXMLObject(cmd_id=cmd_id, object=object,
gid=object_gid, xml_string=xml_string, more_data=more_data,
......@@ -841,12 +842,12 @@ class XMLSyncUtilsMixin(SyncCode):
signature = subscriber.getSignature(object_gid)
object = domain.getObjectFromGid(object_gid)
if signature == None:
LOG('applyActionList, signature is None',0,signature)
#LOG('applyActionList, signature is None',0,signature)
signature = Signature(gid=object_gid, status=self.NOT_SYNCHRONIZED,
object=object).__of__(subscriber)
subscriber.addSignature(signature)
force = signature.getForce()
LOG('applyActionList',0,'object: %s' % repr(object))
#LOG('applyActionList',0,'object: %s' % repr(object))
if self.checkActionMoreData(next_action) == 0:
data_subnode = None
if partial_data != None:
......@@ -855,7 +856,7 @@ class XMLSyncUtilsMixin(SyncCode):
data_subnode = signature.getPartialXML() + partial_data
else:
data_subnode = partial_data
LOG('SyncModif',0,'data_subnode: %s' % data_subnode)
#LOG('SyncModif',0,'data_subnode: %s' % data_subnode)
#data_subnode = FromXml(data_subnode)
if subscriber.getMediaType() == self.MEDIA_TYPE['TEXT_XML']:
data_subnode = Parse(data_subnode)
......@@ -877,10 +878,10 @@ class XMLSyncUtilsMixin(SyncCode):
conflict_list += add_data['conflict_list']
# Retrieve directly the object from addNode
object = add_data['object']
LOG('XMLSyncUtils, in ADD add_data',0,add_data)
#LOG('XMLSyncUtils, in ADD add_data',0,add_data)
if object is not None:
signature.setPath(object.getPhysicalPath())
LOG('applyActionList',0,'object after add: %s' % repr(object))
#LOG('applyActionList',0,'object after add: %s' % repr(object))
else:
#Object was retrieve but need to be updated without recreated
#usefull when an object is only deleted by workflow.
......@@ -892,7 +893,7 @@ class XMLSyncUtilsMixin(SyncCode):
if add_data['conflict_list'] not in ('', None, []):
conflict_list += add_data['conflict_list']
if object is not None:
LOG('SyncModif',0,'addNode, found the object')
#LOG('SyncModif',0,'addNode, found the object')
#mapping = getattr(object,domain.getXMLMapping(),None)
xml_object = domain.getXMLFromObject(object)
#if mapping is not None:
......@@ -905,11 +906,11 @@ class XMLSyncUtilsMixin(SyncCode):
self.SyncMLConfirmation(cmd_id,object_gid,self.SUCCESS,'Add')
cmd_id +=1
elif next_action.nodeName == 'Replace':
LOG('SyncModif',0,'object: %s will be updated...' % str(object))
#LOG('SyncModif',0,'object: %s will be updated...' % str(object))
if object is not None:
LOG('SyncModif',0,'object: %s will be updated...' % object.id)
#LOG('SyncModif',0,'object: %s will be updated...' % object.id)
signature = subscriber.getSignature(object_gid)
LOG('SyncModif',0,'previous signature: %s' % str(signature))
#LOG('SyncModif',0,'previous signature: %s' % str(signature))
previous_xml = signature.getXML()
#LOG('SyncModif',0,'previous signature: %i' % len(previous_xml))
conflict_list += conduit.updateNode(xml=data_subnode, object=object,
......@@ -941,7 +942,7 @@ class XMLSyncUtilsMixin(SyncCode):
string_io = StringIO()
PrettyPrint(data_subnode,stream=string_io)
data_subnode_string = string_io.getvalue()
LOG('applyActionList, subscriber_xupdate:',0,data_subnode_string)
#LOG('applyActionList, subscriber_xupdate:',0,data_subnode_string)
signature.setSubscriberXupdate(data_subnode_string)
elif next_action.nodeName == 'Delete':
......@@ -963,7 +964,7 @@ class XMLSyncUtilsMixin(SyncCode):
previous_partial += partial_data
signature.setPartialXML(previous_partial)
#LOG('SyncModif',0,'previous_partial: %s' % str(previous_partial))
LOG('SyncModif',0,'waiting more data for :%s' % signature.getId())
#LOG('SyncModif',0,'waiting more data for :%s' % signature.getId())
xml_confirmation += self.SyncMLConfirmation(cmd_id, object_gid,
self.WAITING_DATA, next_action.nodeName)
if conflict_list != [] and signature is not None:
......@@ -979,7 +980,7 @@ class XMLSyncUtilsMixin(SyncCode):
This method have to change status codes on signatures
"""
next_status = self.getNextSyncBodyStatus(remote_xml, None)
LOG('applyStatusList, next_status',0,next_status)
#LOG('applyStatusList, next_status',0,next_status)
# We do not want the first one
next_status = self.getNextSyncBodyStatus(remote_xml, next_status)
has_status_list = 0
......@@ -991,7 +992,7 @@ class XMLSyncUtilsMixin(SyncCode):
status_code = self.getStatusCode(next_status)
status_cmd = self.getStatusCommand(next_status)
signature = subscriber.getSignature(object_gid)
LOG('SyncModif',0,'next_status: %s' % str(status_code))
#LOG('SyncModif',0,'next_status: %s' % str(status_code))
if status_cmd in ('Add','Replace'):
if status_code == self.CHUNK_OK:
destination_waiting_more_data = 1
......@@ -1043,7 +1044,7 @@ class XMLSyncUtils(XMLSyncUtilsMixin):
from Products.ERP5SyncML import Conduit
has_response = 0 #check if syncmodif replies to this messages
cmd_id = 1 # specifies a SyncML message-unique command identifier
LOG('SyncModif',0,'Starting... domain: %s' % str(domain))
#LOG('SyncModif',0,'Starting... domain: %s' % str(domain))
# Get the destination folder
destination_path = self.unrestrictedTraverse(domain.getDestinationPath())
......@@ -1051,7 +1052,7 @@ class XMLSyncUtils(XMLSyncUtilsMixin):
# Get informations from the header
xml_header = first_node.childNodes[1]
if xml_header.nodeName != "SyncHdr":
LOG('PubSyncModif',0,'This is not a SyncML Header')
#LOG('PubSyncModif',0,'This is not a SyncML Header')
raise ValueError, "Sorry, This is not a SyncML Header"
subscriber = domain # If we are the client, this is fine
......@@ -1072,9 +1073,9 @@ class XMLSyncUtils(XMLSyncUtilsMixin):
message_id = self.getMessageId(remote_xml)
correct_message = subscriber.checkCorrectRemoteMessageId(message_id)
if not correct_message: # We need to send again the message
LOG('SyncModif, no correct message:',0,"sending again...")
#LOG('SyncModif, no correct message:',0,"sending again...")
last_xml = subscriber.getLastSentMessage()
LOG("last_xml :", 0, last_xml)
#LOG("last_xml :", 0, last_xml)
if last_xml != '':
has_response = 1
if domain.domain_type == self.PUB: # We always reply
......
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