Commit cfc72d03 authored by Sriram Karra's avatar Sriram Karra

Fix EX sync to use get_itemid_from_synctags at folder level

parent 4a5a1c42
......@@ -41,7 +41,7 @@ class EXContactError(Exception):
class EXContact(Contact):
prop_update_t = utils.enum('PROP_REPLACE', 'PROP_APPEND')
def __init__ (self, folder, ews_con=None, con=None):
def __init__ (self, folder, ews_con=None, con=None, con_itemid=None):
"""Constructor for EXContact. The starting properties of the contact
can be initialized either from an existing Contact object, or from an
pyews contact object. It is an error to provide both.
......@@ -53,19 +53,11 @@ class EXContact(Contact):
Contact.__init__(self, folder, con)
## Sometimes we might be creating a contact object from a remote
## source which might have the Entry ID in its sync tags field. if
## that is present, we should use it to initialize the itemid field
## for the current object
conf = self.get_config()
if con:
try:
pname_re = conf.get_profile_name_re()
label = conf.make_sync_label(pname_re, self.get_dbid())
tag, itemid = con.get_sync_tags(label)[0]
self.set_itemid(itemid)
except Exception, e:
if con_itemid:
self.set_itemid(con_itemid)
else:
logging.debug('Potential new EXContact: %s', con.get_disp_name())
self.set_ews_con(ews_con)
......
......@@ -178,7 +178,8 @@ class EXFolder(Folder):
ex_cons = []
for item in items:
exc = EXContact(self, con=item)
con_itemid = item.get_itemid_from_synctags(pname, 'ex')
exc = EXContact(self, con=item, con_itemid=con_itemid)
rid = item.get_itemid()
exc.update_sync_tags(src_sync_tag, rid)
......
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