[REF] sync_google_contact: Removed the gdata.contacts.client dependancies to make it compatible with old versions.
bzr revid: uco@tinyerp.com-20110325115110-rmlldnzh796uflkz
This commit is contained in:
parent
3cedb5c181
commit
eb7de7bc45
|
@ -35,11 +35,7 @@ class google_login(osv.osv_memory):
|
|||
}
|
||||
|
||||
def google_login(self, user, password, type='group', context=None):
|
||||
gd_client=False
|
||||
if type=='group':
|
||||
gd_client=gdata.contacts.client.ContactsClient(source='OpenERP')
|
||||
if type=='contact' :
|
||||
gd_client = gdata.contacts.service.ContactsService()
|
||||
gd_client = gdata.contacts.service.ContactsService()
|
||||
try:
|
||||
gd_client.ClientLogin(user, password,gd_client.source)
|
||||
except Exception:
|
||||
|
|
|
@ -26,7 +26,6 @@ try:
|
|||
import gdata
|
||||
import gdata.contacts.service
|
||||
import gdata.contacts
|
||||
import gdata.contacts.client
|
||||
except ImportError:
|
||||
raise osv.except_osv(_('Google Contacts Import Error!'), _('Please install gdata-python-client from http://code.google.com/p/gdata-python-client/downloads/list'))
|
||||
|
||||
|
@ -66,15 +65,12 @@ class synchronize_google_contact(osv.osv_memory):
|
|||
if not gd_client:
|
||||
raise osv.except_osv(_('Error'), _("Authentication fail check the user and password !"))
|
||||
|
||||
query = gdata.contacts.client.ContactsQuery(feed='/m8/feeds/groups/default/full')
|
||||
res = []
|
||||
query = gdata.contacts.service.GroupsQuery(feed='/m8/feeds/groups/default/full')
|
||||
if gd_client:
|
||||
groups = gd_client.GetGroups(q=query)
|
||||
groups = gd_client.GetFeed(query.ToUri())
|
||||
for grp in groups.entry:
|
||||
title = grp.title.text
|
||||
if 'System Group' in grp.title.text:
|
||||
title = grp.title.text.split(': ')[1]
|
||||
res.append((grp.id.text, title))
|
||||
res.append((grp.id.text, grp.title.text))
|
||||
res.append(('all','All Groups'))
|
||||
return res
|
||||
|
||||
|
|
Loading…
Reference in New Issue