-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroutes.py
136 lines (126 loc) · 3.98 KB
/
routes.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
"""
Using redirect route instead of simple routes since it supports strict_slash
Simple route: http://webapp-improved.appspot.com/guide/routing.html#simple-routes
RedirectRoute: http://webapp-improved.appspot.com/api/webapp2_extras/routes.html#webapp2_extras.routes.RedirectRoute
"""
from webapp2_extras.routes import RedirectRoute
import handlers
import taskhandlers
secure_scheme = 'https'
_routes = [
RedirectRoute('/register',
handlers.RegisterHandler,
name='register',
strict_slash=True),
RedirectRoute('/register-success',
handlers.RegisterSuccessHandler,
name='register-success',
strict_slash=True),
RedirectRoute('/register-student',
handlers.RegisterStudentHandler,
name='register-student',
strict_slash=True),
RedirectRoute('/edit-student/<student_id>',
handlers.EditStudentHandler,
name='edit-student',
strict_slash=True),
RedirectRoute('/util/validate-student/<student_id>',
handlers.ValidateStudentHandler,
name='validate-student',
strict_slash=True),
## RedirectRoute('/util/invite-student/<student_key>',
## handlers.InviteStudentEmailHandler,
## name='invite-student',
## strict_slash=True),
RedirectRoute('/dashboard',
handlers.DashboardHandler,
name='dashboard',
strict_slash=True),
RedirectRoute('/student-activation',
handlers.StudentActivationHandler,
name='student-activation',
strict_slash=True),
RedirectRoute('/student-dashboard',
handlers.StudentDashboardHandler,
name='student-dashboard',
strict_slash=True),
RedirectRoute('/login',
handlers.LoginHandler,
name='login',
strict_slash=True),
RedirectRoute('/login-return',
handlers.LoginReturnHandler,
name='login-return',
strict_slash=True),
## RedirectRoute('/teacher-login',
## handlers.TeacherLoginHandler,
## name='teacher-login',
## strict_slash=True),
RedirectRoute('/logout',
handlers.LogoutHandler,
name='logout',
strict_slash=True),
## Codeforces iframe ##
RedirectRoute('/cf/start-coding',
handlers.CodeforcesIFrameHandler,
name='start-coding',
strict_slash=True),
## Real Nation Links ##
RedirectRoute('/rn/dashboard',
handlers.RealNationDashboardHandler,
name='rn-dashboard',
strict_slash=True),
## Task Handlers ##
RedirectRoute('/tasks/invite-student',
taskhandlers.InviteStudentHandler,
name='invite-student-task',
strict_slash=True),
## RedirectRoute('/tasks/add-invite-student',
## taskhandlers.AddInviteStudentTask,
## name='add-invite-student-task',
## strict_slash=True),
## Static Content Links ##
RedirectRoute('/about',
handlers.AboutHandler,
name='about',
strict_slash=True),
RedirectRoute('/contact',
handlers.ContactHandler,
name='contact',
strict_slash=True),
RedirectRoute('/announcements',
handlers.AnnouncementsHandler,
name='announcements',
strict_slash=True),
RedirectRoute('/faqs',
handlers.FAQsHandler,
name='faqs',
strict_slash=True),
RedirectRoute('/resources',
handlers.ResourcesHandler,
name='resources',
strict_slash=True),
RedirectRoute('/news',
handlers.NewsHandler,
name='news',
strict_slash=True),
RedirectRoute('/privacy-policy',
handlers.PrivacyHandler,
name='privacy-policy',
strict_slash=True),
RedirectRoute('/rules',
handlers.RulesHandler,
name='rules',
strict_slash=True),
RedirectRoute('/',
handlers.MainHandler,
name='home',
strict_slash=True),
]
def get_routes():
return _routes
def add_routes(app):
if app.debug:
secure_scheme = 'http'
for r in _routes:
app.router.add(r)