Debug output for google sync

This commit is contained in:
Martin Bauer 2014-06-17 23:42:18 +02:00
parent 1aa23d2691
commit 5fc206112d
2 changed files with 10 additions and 2 deletions

View File

@ -242,6 +242,7 @@ def syncFromGoogleToLocal( service = None ):
if service is None: service = getServiceObject() if service is None: service = getServiceObject()
newStatusReceived = False
allEvents = getAllGCalEvents( service, fromNow=True) allEvents = getAllGCalEvents( service, fromNow=True)
for e in allEvents: for e in allEvents:
localId = e['extendedProperties']['private']['blechreizID'] localId = e['extendedProperties']['private']['blechreizID']
@ -268,6 +269,9 @@ def syncFromGoogleToLocal( service = None ):
# and an endless loop is entered # and an endless loop is entered
if prev.status != part.status or prev.comment != part.comment: if prev.status != part.status or prev.comment != part.comment:
part.save() part.save()
newStatusReceived = True
return newStatusReceived

View File

@ -2,6 +2,7 @@ from django.shortcuts import redirect
from eventplanner_gcal.google_sync import syncFromGoogleToLocal, syncFromLocalToGoogle from eventplanner_gcal.google_sync import syncFromGoogleToLocal, syncFromLocalToGoogle
from django.http import HttpResponse from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt from django.views.decorators.csrf import csrf_exempt
from pprint import pformat
import logging import logging
@ -14,8 +15,11 @@ def runSync( request ):
@csrf_exempt @csrf_exempt
def gcalApiCallback( request ): def gcalApiCallback( request ):
syncFromGoogleToLocal() # TODO check channel info here
logger.info("Received callback from GCal - updating event participations... ") requestMetaStr = pformat( request.META )
logger.info( "Received Google Callback with the following headers:\n" + requestMetaStr )
result = syncFromGoogleToLocal()
logger.info("Finished processing callback from GCal - New Information present: %1 " %(result, ) )
return HttpResponse('<h1>Callback successful</h1>') return HttpResponse('<h1>Callback successful</h1>')