Further changes from live site
This commit is contained in:
@@ -19,13 +19,18 @@ def createGCalServiceObject():
|
||||
"""Creates a Google API service object. This object is required whenever a Google API call is made"""
|
||||
from oauth2client.file import Storage
|
||||
from apiclient.discovery import build
|
||||
from oauth2client import tools, client
|
||||
|
||||
gcal_settings = settings.GCAL_COUPLING
|
||||
|
||||
storage = Storage( gcal_settings['credentials_file'] )
|
||||
credentials = storage.get()
|
||||
|
||||
print("credentials", credentials)
|
||||
if credentials is None or credentials.invalid == True:
|
||||
#flow = client.flow_from_clientsecrets(CLIENT_SEICRET_FILE, SCOPES)
|
||||
|
||||
print("invalid credentials for gcal")
|
||||
logger.error("Unable to initialize Google Calendar coupling. Check your settings!")
|
||||
return None
|
||||
|
||||
@@ -34,6 +39,7 @@ def createGCalServiceObject():
|
||||
res = build( serviceName='calendar', version='v3',
|
||||
http=http, developerKey=gcal_settings['developerKey'] )
|
||||
|
||||
print("res", res)
|
||||
if res is None:
|
||||
logger.error( "Authentication at google API failed. Check your settings!" )
|
||||
return res
|
||||
@@ -216,8 +222,9 @@ def syncFromLocalToGoogle( service = None ):
|
||||
""" Creates a google event for each local event (if it does not exist yet) and deletes all google events
|
||||
that are not found in local database. Updates participation info of gcal events using local data
|
||||
"""
|
||||
|
||||
if service is None: service = getServiceObject()
|
||||
|
||||
|
||||
allEvents = getAllGCalEvents( service )
|
||||
|
||||
eventsAtGoogle_djangoID = set()
|
||||
@@ -271,7 +278,7 @@ def syncFromLocalToGoogle( service = None ):
|
||||
|
||||
def syncFromGoogleToLocal( service = None ):
|
||||
"""Retrieves only participation infos for all events and updates local database if anything has changed. """
|
||||
|
||||
|
||||
if service is None: service = getServiceObject()
|
||||
|
||||
newStatusReceived = False
|
||||
|
||||
Reference in New Issue
Block a user