Commit 4a5a1c42 authored by Sriram Karra's avatar Sriram Karra

Fix CD sync to use get_itemid_from_synctags at folder level

parent 32768db9
......@@ -74,7 +74,7 @@ class CDContact(Contact):
def __init__ (self, folder, con=None, vco=None, itemid=None,
def __init__ (self, folder, con=None, con_itemid=None, vco=None, itemid=None,
"""vco, if not None, should be a valid vCard object (i.e. the contents
of a vCard file, for e.g. When vco is not None, itemid should also be
......@@ -89,22 +89,12 @@ class CDContact(Contact):
self._group_count = 0
## Sometimes we might be creating a contact object from a Google
## contact object or other entry which might have the 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:
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]
except Exception, e:
if con_itemid:
logging.debug('Potential new CDContact: %s', con.get_name())
elif vco:
if not self.debug_vcf:
......@@ -205,7 +205,8 @@ class CDContactsFolder(Folder):
## to PUT the damn items one at a time. What kind of a standard is
## this, anyway?
cd = CDContact(self, con=item)
con_itemid = item.get_itemid_from_synctags(pname, 'cd')
cd = CDContact(self, con=item, con_itemid=con_itemid)
cd.update_sync_tags(src_sync_tag, item.get_itemid(), save=True)
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