From 5a554c49ba71f54567b76e3687fe0836a137a773 Mon Sep 17 00:00:00 2001 From: "Bhumika (OpenERP)" Date: Wed, 1 Jun 2011 18:44:58 +0530 Subject: [PATCH] [FIX] google_base_account: remove unused code bzr revid: sbh@tinyerp.com-20110601131458-3kkhkh39jtpdkv0j --- .../wizard/google_login.py | 31 +++++-------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/addons/google_base_account/wizard/google_login.py b/addons/google_base_account/wizard/google_login.py index d32e2701569..d886e58561d 100644 --- a/addons/google_base_account/wizard/google_login.py +++ b/addons/google_base_account/wizard/google_login.py @@ -34,19 +34,12 @@ class google_login(osv.osv_memory): 'password': fields.char('Google Password', size=64), } - def google_login(self,cr,uid,user,password,type='',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() - if type == 'calendar': - gd_client = gdata.calendar.service.CalendarService() + def google_login(self, user, password, type='group', context=None): + gd_client = gdata.contacts.service.ContactsService() try: gd_client.ClientLogin(user, password,gd_client.source) - - except Exception, e: - raise osv.except_osv(_('Error'), _(e)) + except Exception: + return False return gd_client @@ -58,19 +51,12 @@ class google_login(osv.osv_memory): if 'password' in fields: res.update({'password': user_obj.gmail_password}) return res - - def check_login(self, cr, uid, ids, context=None): - if context == None: - context = {} + + def login(self, cr, uid, ids, context=None): data = self.read(cr, uid, ids)[0] user = data['user'] password = data['password'] - gd_client = gdata.contacts.service.ContactsService() - gd_client.email = user - gd_client.password = password - gd_client.source = 'OpenERP' - try: - gd_client.ProgrammaticLogin() + if self.google_login(user, password): res = { 'gmail_user': user, 'gmail_password': password @@ -79,7 +65,6 @@ class google_login(osv.osv_memory): else: raise osv.except_osv(_('Error'), _("Authentication fail check the user and password !")) - return self._get_next_action(cr, uid, context=context) def _get_next_action(self, cr, uid, context=None): @@ -87,4 +72,4 @@ class google_login(osv.osv_memory): google_login() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file