From e92e633e64917241ab584a12df9cb318b02b0b97 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 11 Feb 2015 15:16:43 +0100 Subject: [PATCH] [FIX] google_account: sync of event deleted google side When creating and deleting (disabling, actually)an event without syncyng with google, this is possible that Google returns a 404 status page, meaning the event we are trying to delete google side do not exist. We can safely ignore these 404 pages, as the event are not anymore existing in Odoo side either opw-627767 --- addons/google_account/google_account.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/addons/google_account/google_account.py b/addons/google_account/google_account.py index 30330819d80..db137b087e6 100644 --- a/addons/google_account/google_account.py +++ b/addons/google_account/google_account.py @@ -137,6 +137,7 @@ class google_service(osv.osv_memory): status = 418 response = "" + ask_time = datetime.now().strftime(DEFAULT_SERVER_DATETIME_FORMAT) try: if type.upper() == 'GET' or type.upper() == 'DELETE': data = werkzeug.url_encode(params) @@ -159,13 +160,16 @@ class google_service(osv.osv_memory): try: ask_time = datetime.strptime(request.headers.get('date'), "%a, %d %b %Y %H:%M:%S %Z") except: - ask_time = datetime.now().strftime(DEFAULT_SERVER_DATETIME_FORMAT) + pass except urllib2.HTTPError, e: if e.code in (400, 401, 410): raise e - - _logger.exception("Bad google request : %s !" % e.read()) - raise self.pool.get('res.config.settings').get_config_warning(cr, _("Something went wrong with your request to google"), context=context) + elif e.code in (204, 404): + status = e.code + response = "" + else: + _logger.exception("Bad google request : %s !" % e.read()) + raise self.pool.get('res.config.settings').get_config_warning(cr, _("Something went wrong with your request to google"), context=context) return (status, response, ask_time) def get_base_url(self, cr, uid, context=None):