Commit b5400f15 authored by Sriram Karra's avatar Sriram Karra

Fix GC sync to use get_itemid_from_synctags at folder level

parent 72d4dce7
......@@ -37,23 +37,14 @@ class GCContact(Contact):
"""This class extends the Contact abstract base class to wrap a Google
Contact"""
def __init__ (self, folder, con=None, gce=None):
def __init__ (self, folder, con=None, con_itemid=None, gce=None):
Contact.__init__(self, folder, con)
## Sometimes we might be creating a contact object from Outlook or
## other entry which might have the google contact 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(self.normalize_gcid(itemid))
except Exception, e:
if con_itemid:
self.set_itemid(self.normalize_gcid(con_itemid))
else:
logging.debug('Potential new GCContact: %s', con.get_name())
self.set_gce(gce)
......
......@@ -256,7 +256,8 @@ class GCContactsFolder(Folder):
success = True
for item in items:
gc = GCContact(self, con=item)
con_itemid = item.get_itemid_from_synctags(pname, 'gc')
gc = GCContact(self, con=item, con_itemid=con_itemid)
bid = item.get_itemid()
gc.update_sync_tags(src_sync_tag, bid)
......
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