-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.py
66 lines (50 loc) · 1.71 KB
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
from flask import Flask, render_template
from flask import Response
from flask import request
from caldavclient import CaldavClient
import db_manager
app = Flask(__name__)
@app.route('/')
def routeMain():
return 'hello'
@app.route('/login')
def routeLogin():
return render_template('login.html')
@app.route('/calendar', methods=['POST','GET'])
def routeCalendar():
print("calendar")
hostname = request.form['hostname']
userId = request.form['userId']
userPw = request.form['userPw']
client = CaldavClient(
hostname,
userId,
userPw
)
principal = client.getPrincipal()
homeset = principal.getHomeSet()
calendars = homeset.getCalendars()
calendarList = ""
for calendar in calendars:
# print(calendar.calendarName + " " + calendar.calendarUrl + " " + calendar.cTag)
calendarList+= "<input type=checkbox name=chk_info value='%s'>%s" % (calendar.calendarUrl, calendar.calendarName) + "</br>"
return render_template('select_calendar.html', calendarList = calendars)
@app.route('/display_calendar', methods=['POST','GET'])
def routeDisplay():
ls_evts = [] # in Selected Calendar
db_manager.initInsertCalendars(client, principal, homeset, calendars)
return render_template('ls_event.html',result=ls_evts)
@app.route('/display_all_calendar')
def routeDisplayAll():
client = CaldavClient(
hostname,
userId,
userPw
)
principal = client.getPrincipal()
homeset = principal.getHomeSet()
calendars = homeset.getCalendars()
db_manager.initInsertCalendars(client, principal, homeset, calendars)
return render_template('ls_event.html',result=ls_evts)
if __name__ == "__main__":
app.run()