diff --git a/addons/google_calendar/google_calendar.py b/addons/google_calendar/google_calendar.py index 1bcbad15413..14895042153 100644 --- a/addons/google_calendar/google_calendar.py +++ b/addons/google_calendar/google_calendar.py @@ -20,11 +20,8 @@ import logging _logger = logging.getLogger(__name__) -def status_response(status, substr=False): - if substr: - return int(str(status)[0]) - else: - return status_response(status, substr=True) == 2 +def status_response(status): + return int(str(status)[0]) == 2 class Meta(type): @@ -99,7 +96,6 @@ class SyncEvent(object): tmpSrc = 'OE' assert tmpSrc in ['GG', 'OE'] - #if self.OP.action == None: if self[tmpSrc].isRecurrence: if self[tmpSrc].status: self.OP = Update(tmpSrc, 'Only need to update, because i\'m active') @@ -312,7 +308,6 @@ class google_calendar(osv.AbstractModel): 'fields': 'items,nextPageToken', 'access_token': token, 'maxResults': 1000, - #'timeMin': self.get_minTime(cr, uid, context=context).strftime("%Y-%m-%dT%H:%M:%S.%fz"), } if lastSync: @@ -552,18 +547,6 @@ class google_calendar(osv.AbstractModel): if context is None: context = {} - # def isValidSync(syncToken): - # gs_pool = self.pool['google.service'] - # params = { - # 'maxResults': 1, - # 'fields': 'id', - # 'access_token': self.get_token(cr, uid, context), - # 'syncToken': syncToken, - # } - # url = "/calendar/v3/calendars/primary/events" - # status, response = gs_pool._do_request(cr, uid, url, params, type='GET', context=context) - # return int(status) != 410 - user_to_sync = ids and ids[0] or uid current_user = self.pool['res.users'].browse(cr, SUPERUSER_ID, user_to_sync, context=context) @@ -927,7 +910,7 @@ class google_calendar(osv.AbstractModel): return current_user.google_calendar_rtoken is False def get_calendar_scope(self, RO=False): - readonly = RO and '.readonly' or '' + readonly = '.readonly' if RO else '' return 'https://www.googleapis.com/auth/calendar%s' % (readonly) def authorize_google_uri(self, cr, uid, from_url='http://www.openerp.com', context=None):