routine no longer creates file
This commit is contained in:
parent
060e506547
commit
f94c64e699
14
Routine.py
14
Routine.py
@ -12,13 +12,11 @@ class Routine:
|
|||||||
self.updateCalendars()
|
self.updateCalendars()
|
||||||
|
|
||||||
|
|
||||||
def updateCalendars(self):
|
def updateCalendar(self, user):
|
||||||
users = User.query.all()
|
|
||||||
for user in users:
|
|
||||||
# check google:
|
# check google:
|
||||||
credentials = user.getGoogleCredentials()
|
credentials = user.getGoogleCredentials()
|
||||||
if credentials is None:
|
if credentials is None:
|
||||||
continue
|
return
|
||||||
|
|
||||||
visualCals = []
|
visualCals = []
|
||||||
calendars = db.session.query(Calendar).filter(Calendar.usr_id==user.id).all()
|
calendars = db.session.query(Calendar).filter(Calendar.usr_id==user.id).all()
|
||||||
@ -28,11 +26,19 @@ class Routine:
|
|||||||
googleCreds = google.oauth2.credentials.Credentials(**credentials)
|
googleCreds = google.oauth2.credentials.Credentials(**credentials)
|
||||||
calendarjson = caltojson.generateJsonFromCalendarEntries(visualCals, googleCreds)
|
calendarjson = caltojson.generateJsonFromCalendarEntries(visualCals, googleCreds)
|
||||||
user.setJson(calendarjson)
|
user.setJson(calendarjson)
|
||||||
|
'''
|
||||||
directory = 'userinfo/' + user.id + '/'
|
directory = 'userinfo/' + user.id + '/'
|
||||||
if not os.path.exists(directory):
|
if not os.path.exists(directory):
|
||||||
os.makedirs(directory)
|
os.makedirs(directory)
|
||||||
with open(directory + 'calendarevents.json', 'w', encoding='utf-8') as f:
|
with open(directory + 'calendarevents.json', 'w', encoding='utf-8') as f:
|
||||||
json.dump(calendarjson, f, ensure_ascii=False, indent=4)
|
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):
|
def credentials_to_dict(credentials):
|
||||||
return{'token': credentials.token,
|
return{'token': credentials.token,
|
||||||
|
Loading…
Reference in New Issue
Block a user