From 5fc206112d12d88bbf29ec29c071e664e0cc750b Mon Sep 17 00:00:00 2001 From: Martin Bauer Date: Tue, 17 Jun 2014 23:42:18 +0200 Subject: [PATCH] Debug output for google sync --- eventplanner_gcal/google_sync.py | 4 ++++ eventplanner_gcal/views.py | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/eventplanner_gcal/google_sync.py b/eventplanner_gcal/google_sync.py index ae7bd0c..cb366d4 100644 --- a/eventplanner_gcal/google_sync.py +++ b/eventplanner_gcal/google_sync.py @@ -242,6 +242,7 @@ def syncFromGoogleToLocal( service = None ): if service is None: service = getServiceObject() + newStatusReceived = False allEvents = getAllGCalEvents( service, fromNow=True) for e in allEvents: localId = e['extendedProperties']['private']['blechreizID'] @@ -268,6 +269,9 @@ def syncFromGoogleToLocal( service = None ): # and an endless loop is entered if prev.status != part.status or prev.comment != part.comment: part.save() + newStatusReceived = True + + return newStatusReceived diff --git a/eventplanner_gcal/views.py b/eventplanner_gcal/views.py index fead45c..b2ff149 100644 --- a/eventplanner_gcal/views.py +++ b/eventplanner_gcal/views.py @@ -2,6 +2,7 @@ from django.shortcuts import redirect from eventplanner_gcal.google_sync import syncFromGoogleToLocal, syncFromLocalToGoogle from django.http import HttpResponse from django.views.decorators.csrf import csrf_exempt +from pprint import pformat import logging @@ -14,8 +15,11 @@ def runSync( request ): @csrf_exempt def gcalApiCallback( request ): - syncFromGoogleToLocal() - logger.info("Received callback from GCal - updating event participations... ") + # TODO check channel info here + 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('

Callback successful

')