Fix for revoking already expired channel (drive)

This commit is contained in:
Jack Darlington 2017-03-12 00:24:53 +00:00
parent e3a2bd348c
commit dad251d02c

View File

@ -56,6 +56,8 @@ import io
import hashlib import hashlib
import threading import threading
from googleapiclient.errors import HttpError
from tornado import version as tornadoVersion from tornado import version as tornadoVersion
try: try:
@ -1309,7 +1311,10 @@ def watch_gdrive():
def revoke_watch_gdrive(): def revoke_watch_gdrive():
last_watch_response=config.config_google_drive_watch_changes_response last_watch_response=config.config_google_drive_watch_changes_response
if last_watch_response: if last_watch_response:
response=gdriveutils.stopChannel(Gdrive.Instance().drive, last_watch_response['id'], last_watch_response['resourceId']) try:
response=gdriveutils.stopChannel(Gdrive.Instance().drive, last_watch_response['id'], last_watch_response['resourceId'])
except HttpError, e:
pass
settings = ub.session.query(ub.Settings).first() settings = ub.session.query(ub.Settings).first()
settings.config_google_drive_watch_changes_response=None settings.config_google_drive_watch_changes_response=None
ub.session.merge(settings) ub.session.merge(settings)