From f94c64e699e29cac8c707337e219ada64a1ae01e Mon Sep 17 00:00:00 2001 From: Raphael Maenle Date: Sun, 24 May 2020 13:25:15 +0200 Subject: [PATCH] routine no longer creates file --- Routine.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Routine.py b/Routine.py index a5ec40f..7e3a718 100644 --- a/Routine.py +++ b/Routine.py @@ -12,13 +12,11 @@ class Routine: self.updateCalendars() - def updateCalendars(self): - users = User.query.all() - for user in users: + def updateCalendar(self, user): # check google: credentials = user.getGoogleCredentials() if credentials is None: - continue + return visualCals = [] calendars = db.session.query(Calendar).filter(Calendar.usr_id==user.id).all() @@ -28,11 +26,19 @@ class Routine: googleCreds = google.oauth2.credentials.Credentials(**credentials) calendarjson = caltojson.generateJsonFromCalendarEntries(visualCals, googleCreds) user.setJson(calendarjson) + ''' directory = 'userinfo/' + user.id + '/' if not os.path.exists(directory): os.makedirs(directory) with open(directory + 'calendarevents.json', 'w', encoding='utf-8') as f: json.dump(calendarjson, f, ensure_ascii=False, indent=4) + ''' + + + def updateCalendars(self): + users = User.query.all() + for user in users: + self.updateCalendar(user) def credentials_to_dict(credentials): return{'token': credentials.token,