Commit e12d8484 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Commented all logs. Added XXX comments.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14395 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 463de10f
...@@ -51,6 +51,7 @@ class Conflict(SyncCode, Base): ...@@ -51,6 +51,7 @@ class Conflict(SyncCode, Base):
""" """
isIndexable = 0 isIndexable = 0
isPortalContent = 0 # Make sure RAD generated accessors at the class level
def __init__(self, object_path=None, keyword=None, xupdate=None, publisher_value=None,\ def __init__(self, object_path=None, keyword=None, xupdate=None, publisher_value=None,\
subscriber_value=None, subscriber=None): subscriber_value=None, subscriber=None):
...@@ -241,7 +242,8 @@ class Signature(Folder,SyncCode): ...@@ -241,7 +242,8 @@ class Signature(Folder,SyncCode):
xml -- the xml of the object at the time where it was synchronized xml -- the xml of the object at the time where it was synchronized
""" """
isIndexable = 0 isIndexable = 0
isPortalContent = 0 # Make sure RAD generated accessors at the class level
# Constructor # Constructor
def __init__(self,gid=None, id=None, status=None, xml_string=None,object=None): def __init__(self,gid=None, id=None, status=None, xml_string=None,object=None):
self.setGid(gid) self.setGid(gid)
...@@ -511,7 +513,7 @@ class Signature(Folder,SyncCode): ...@@ -511,7 +513,7 @@ class Signature(Folder,SyncCode):
""" """
Return the actual action for a partial synchronization Return the actual action for a partial synchronization
""" """
LOG('setConflictList, list',0,conflict_list) # LOG('setConflictList, list',0,conflict_list)
for conflict in conflict_list: for conflict in conflict_list:
if isinstance(conflict,str): if isinstance(conflict,str):
import pdb; pdb.set_trace() import pdb; pdb.set_trace()
...@@ -524,7 +526,7 @@ class Signature(Folder,SyncCode): ...@@ -524,7 +526,7 @@ class Signature(Folder,SyncCode):
""" """
Return the actual action for a partial synchronization Return the actual action for a partial synchronization
""" """
LOG('delConflict, conflict',0,conflict) # LOG('delConflict, conflict',0,conflict)
conflict_list = [] conflict_list = []
for c in self.getConflictList(): for c in self.getConflictList():
LOG('delConflict, c==conflict',0,c==aq_base(conflict)) LOG('delConflict, c==conflict',0,c==aq_base(conflict))
...@@ -546,7 +548,7 @@ class Signature(Folder,SyncCode): ...@@ -546,7 +548,7 @@ class Signature(Folder,SyncCode):
We will look at date, if there is no changes, no need to syncrhonize We will look at date, if there is no changes, no need to syncrhonize
""" """
last_modification = DateTime(object.ModificationDate()) last_modification = DateTime(object.ModificationDate())
LOG('checkSynchronizationNeeded object.ModificationDate()',0,object.ModificationDate()) # LOG('checkSynchronizationNeeded object.ModificationDate()',0,object.ModificationDate())
last_synchronization = self.getLastSynchronizationDate() last_synchronization = self.getLastSynchronizationDate()
parent = object.aq_parent parent = object.aq_parent
# XXX CPS Specific # XXX CPS Specific
...@@ -557,7 +559,7 @@ class Signature(Folder,SyncCode): ...@@ -557,7 +559,7 @@ class Signature(Folder,SyncCode):
self.getStatus()==self.NOT_SYNCHRONIZED: self.getStatus()==self.NOT_SYNCHRONIZED:
if last_synchronization > last_modification: if last_synchronization > last_modification:
#if 1: #if 1:
LOG('checkSynchronizationNeeded, no modification on: ',0,object.id) # LOG('checkSynchronizationNeeded, no modification on: ',0,object.id)
self.setStatus(self.SYNCHRONIZED) self.setStatus(self.SYNCHRONIZED)
...@@ -611,7 +613,7 @@ class Subscription(Folder, SyncCode): ...@@ -611,7 +613,7 @@ class Subscription(Folder, SyncCode):
""" """
meta_type='ERP5 Subscription' meta_type='ERP5 Subscription'
portal_type='Subscription' # may be useful in the future... portal_type='SyncML Subscription' # may be useful in the future...
isPortalContent = 1 isPortalContent = 1
isRADContent = 1 isRADContent = 1
icon = None icon = None
...@@ -692,14 +694,14 @@ class Subscription(Folder, SyncCode): ...@@ -692,14 +694,14 @@ class Subscription(Folder, SyncCode):
dict_sign = {} dict_sign = {}
for o in self.objectValues(): for o in self.objectValues():
dict_sign[o.getId()] = o.getStatus() dict_sign[o.getId()] = o.getStatus()
LOG('getSignature',0,'signatures_status: %s' % str(dict_sign)) # LOG('getSignature',0,'signatures_status: %s' % str(dict_sign))
# XXXXXXXXXXXXXXXXXXXXXXXXXXXXX # XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
code = self.SLOW_SYNC code = self.SLOW_SYNC
if len(self.objectValues()) > 0: if len(self.objectValues()) > 0:
code = self.TWO_WAY code = self.TWO_WAY
if default is not None: if default is not None:
code = default code = default
LOG('Subscription',0,'getSynchronizationType: %s' % code) # LOG('Subscription',0,'getSynchronizationType: %s' % code)
return code return code
def setXMLMapping(self, value): def setXMLMapping(self, value):
...@@ -731,8 +733,8 @@ class Subscription(Folder, SyncCode): ...@@ -731,8 +733,8 @@ class Subscription(Folder, SyncCode):
return 1 if the message id was not seen, 0 if already seen return 1 if the message id was not seen, 0 if already seen
""" """
last_message_id = getattr(self,'last_message_id',None) last_message_id = getattr(self,'last_message_id',None)
LOG('checkCorrectRemoteMessageId last_message_id =',0,last_message_id) # LOG('checkCorrectRemoteMessageId last_message_id =',0,last_message_id)
LOG('checkCorrectRemoteMessageId message_id =',0,message_id) # LOG('checkCorrectRemoteMessageId message_id =',0,message_id)
if last_message_id == message_id: if last_message_id == message_id:
return 0 return 0
self.last_message_id = message_id self.last_message_id = message_id
...@@ -878,23 +880,23 @@ class Subscription(Folder, SyncCode): ...@@ -878,23 +880,23 @@ class Subscription(Folder, SyncCode):
""" """
o_base = aq_base(object) o_base = aq_base(object)
o_gid = None o_gid = None
LOG('getGidFromObject',0,'gidgenerator : _%s_' % repr(self.getGidGenerator())) # LOG('getGidFromObject',0,'gidgenerator : _%s_' % repr(self.getGidGenerator()))
gid_gen = self.getGidGenerator() gid_gen = self.getGidGenerator()
if callable(gid_gen): if callable(gid_gen):
LOG('getGidFromObject gid_generator',0,'is callable') # LOG('getGidFromObject gid_generator',0,'is callable')
o_gid=gid_gen(object) o_gid=gid_gen(object)
LOG('getGidFromObject',0,'o_gid: %s' % repr(o_gid)) # LOG('getGidFromObject',0,'o_gid: %s' % repr(o_gid))
elif getattr(o_base, gid_gen, None) is not None: elif getattr(o_base, gid_gen, None) is not None:
LOG('getGidFromObject',0,'there is the gid generator on o_base') # LOG('getGidFromObject',0,'there is the gid generator on o_base')
generator = getattr(object, gid_gen) generator = getattr(object, gid_gen)
o_gid = generator() 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))
elif gid_gen is not None: elif gid_gen is not None:
# It might be a script python # It might be a script python
LOG('getGidFromObject',0,'there is the gid generator') # LOG('getGidFromObject',0,'there is the gid generator')
generator = getattr(object,gid_gen) generator = getattr(object,gid_gen)
o_gid = generator(object=object) 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 return o_gid
def getObjectFromGid(self, gid): def getObjectFromGid(self, gid):
...@@ -907,11 +909,12 @@ class Subscription(Folder, SyncCode): ...@@ -907,11 +909,12 @@ class Subscription(Folder, SyncCode):
# the id and the gid # the id and the gid
object_list = self.getObjectList() object_list = self.getObjectList()
destination = self.getDestination() destination = self.getDestination()
LOG('getObjectFromGid',0,'gid: %s' % repr(gid)) # LOG('getObjectFromGid', 0, 'self: %s' % self)
LOG('getObjectFromGid oject_list',0,object_list) # LOG('getObjectFromGid',0,'gid: %s' % repr(gid))
# LOG('getObjectFromGid oject_list',0,object_list)
if signature is not None and signature.getId() is not None: if signature is not None and signature.getId() is not None:
o_id = signature.getId() o_id = signature.getId()
LOG('getObjectFromGid o_id',0,o_id) # LOG('getObjectFromGid o_id',0,o_id)
o = None o = None
try: try:
o = destination._getOb(o_id) o = destination._getOb(o_id)
...@@ -920,11 +923,11 @@ class Subscription(Folder, SyncCode): ...@@ -920,11 +923,11 @@ class Subscription(Folder, SyncCode):
if o is not None and o in object_list: if o is not None and o in object_list:
return o return o
for o in object_list: for o in object_list:
LOG('getObjectFromGid',0,'working on : %s' % repr(o)) # LOG('getObjectFromGid',0,'working on : %s' % repr(o))
o_gid = self.getGidFromObject(o) o_gid = self.getGidFromObject(o)
if o_gid == gid: if o_gid == gid:
return o return o
LOG('getObjectFromGid',0,'returning None') # LOG('getObjectFromGid',0,'returning None')
return None return None
# def setOneWaySyncFromServer(self,value): # def setOneWaySyncFromServer(self,value):
...@@ -950,7 +953,7 @@ class Subscription(Folder, SyncCode): ...@@ -950,7 +953,7 @@ class Subscription(Folder, SyncCode):
query_method = getattr(destination,query,None) query_method = getattr(destination,query,None)
if query_method is not None: if query_method is not None:
query_list = query_method() query_list = query_method()
if callable(query): elif callable(query): # XXX - used to be if callable(query)
query_list = query(destination) query_list = query(destination)
return [x for x in query_list return [x for x in query_list
if not getattr(x,'_conflict_resolution',False)] if not getattr(x,'_conflict_resolution',False)]
...@@ -959,10 +962,10 @@ class Subscription(Folder, SyncCode): ...@@ -959,10 +962,10 @@ class Subscription(Folder, SyncCode):
""" """
This tries to generate a new Id This tries to generate a new Id
""" """
LOG('generateNewId, object: ',0,object.getPhysicalPath()) # LOG('generateNewId, object: ',0,object.getPhysicalPath())
id_generator = self.getIdGenerator() id_generator = self.getIdGenerator()
LOG('generateNewId, id_generator: ',0,id_generator) # LOG('generateNewId, id_generator: ',0,id_generator)
LOG('generateNewId, portal_object: ',0,object.getPortalObject()) # LOG('generateNewId, portal_object: ',0,object.getPortalObject())
if id_generator is not None: if id_generator is not None:
o_base = aq_base(object) o_base = aq_base(object)
new_id = None new_id = None
......
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