Skip to content
Snippets Groups Projects
Commit 4608f1e9 authored by Bhumika Shrimali's avatar Bhumika Shrimali
Browse files

[IMP] google_contact: correct typo and add the goolge lib code for featch code

bzr revid: sbh@tinyerp.com-20110209122201-ycbky7umwcw92phu
parent 73f5405e
Branches
Tags
No related merge requests found
......@@ -28,6 +28,36 @@ try:
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'))
class google_lib(object):
def __init__(self, email, password):
super(google_conact, self).__init__()
self.contact = gdata.contacts.service.ContactsService()
self.contact.email = email
self.contact.password = password
self.contact.source = 'GoogleInc-ContactsPythonSample-1'
self.contact.ProgrammaticLogin()
def _get_contact(self):
feed= gd_client.GetContactsFeed()
return feed
def _get_contact_allGroups(self):
""" fetch all allGroup."""
feed = self.contact.GetGroupsFeed()
return feed
def _create_contact(self,name,primary_email):
""" create a contact."""
new_contact = gdata.contacts.ContactEntry(title=atom.Title(text=name))
# Create a work email address for the contact and use as primary.
new_contact.email.append(gdata.contacts.Email(address=primary_email,
primary='true', rel=gdata.contacts.REL_WORK))
entry = self.contact.CreateContact(new_contact)
return entry
def _delete_contact(self):
self.contact.DeleteContact(selected_entry.GetEditLink().href)
return True
class google_contact(osv.osv):
_description ='Google Contact'
......@@ -37,8 +67,12 @@ class google_contact(osv.osv):
'password': fields.char('Password', size=64,),
}
def get_contact(self, cr, uid, ids, context):
return {}
# Only see the result , we will change the code
for user in self.browse(cr, uid, ids, context=context):
google_obj=google_lib(self.user,self.password)
contact=google_obj._get_contact()
print contact
return {}
google_contact()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
......
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment