21
21
app = Flask (__name__ )
22
22
app .secret_key = os .environ ['FLASK_SECRET_KEY' ]
23
23
24
- app .register_blueprint (bp_admin , url_prefix = '/progcom/ admin' )
24
+ app .register_blueprint (bp_admin , url_prefix = '/admin' )
25
25
26
26
if 'SENTRY_DSN' in os .environ :
27
27
sentry = Sentry (app )
@@ -81,32 +81,32 @@ def security_check():
81
81
return redirect (url_for ('login' ))
82
82
83
83
path = request .path
84
- if (request .user and path .startswith ('/progcom/ admin' )
84
+ if (request .user and path .startswith ('/admin' )
85
85
and request .user .email not in _ADMIN_EMAILS ):
86
86
abort (403 )
87
87
88
- if path .startswith ('/progcom/ screening' ) and THIS_IS_BATCH :
88
+ if path .startswith ('/screening' ) and THIS_IS_BATCH :
89
89
abort (403 )
90
90
91
- if path .startswith ('/progcom/ batch' ) and not THIS_IS_BATCH :
91
+ if path .startswith ('/batch' ) and not THIS_IS_BATCH :
92
92
if request .user and request .user .email not in _ADMIN_EMAILS :
93
93
abort (403 )
94
94
95
95
if request .user :
96
96
return
97
97
98
- safe_prefixes = ('/progcom/ static' , '/progcom/ user' , '/progcom/ feedback' , '/progcom /confirmation' )
98
+ safe_prefixes = ('/static' , '/user' , '/feedback' , '/confirmation' )
99
99
for prefix in safe_prefixes :
100
100
if path .startswith (prefix ):
101
101
return
102
102
103
103
return redirect (url_for ('login' ))
104
104
105
- @app .route ('/progcom/ user/login/' )
105
+ @app .route ('/user/login/' )
106
106
def login ():
107
107
return render_template ('user/login.html' )
108
108
109
- @app .route ('/progcom/ user/login/' , methods = ['POST' ])
109
+ @app .route ('/user/login/' , methods = ['POST' ])
110
110
def login_post ():
111
111
uid = l .check_pw (request .values .get ('email' ),
112
112
request .values .get ('pw' ))
@@ -118,13 +118,13 @@ def login_post():
118
118
flash ('You have not yet been approved.' )
119
119
return redirect (url_for ('login' ))
120
120
session ['userid' ] = uid
121
- return redirect ('/progcom/ ' )
121
+ return redirect ('/' )
122
122
123
- @app .route ('/progcom/ user/new/' )
123
+ @app .route ('/user/new/' )
124
124
def new_user ():
125
125
return render_template ('user/new_user.html' )
126
126
127
- @app .route ('/progcom/ user/new/' , methods = ['POST' ])
127
+ @app .route ('/user/new/' , methods = ['POST' ])
128
128
def new_user_post ():
129
129
email = request .values .get ('email' )
130
130
name = request .values .get ('name' )
@@ -140,24 +140,24 @@ def new_user_post():
140
140
flash ('You will be able to log in after your account is approved!' )
141
141
return redirect (url_for ('login' ))
142
142
143
- @app .route ('/progcom/ user/logout/' )
143
+ @app .route ('/user/logout/' )
144
144
def logout ():
145
145
session .clear ()
146
146
return redirect (url_for ('login' ))
147
147
148
- @app .route ('/progcom/ user/email_login/' )
148
+ @app .route ('/user/email_login/' )
149
149
def request_reset ():
150
150
return render_template ('user/request_reset.html' )
151
151
152
- @app .route ('/progcom/ user/email_login/' , methods = ['POST' ])
152
+ @app .route ('/user/email_login/' , methods = ['POST' ])
153
153
def request_reset_post ():
154
154
if l .send_login_email (request .values .get ('email' )):
155
155
flash ('Reset sent' )
156
156
else :
157
157
flash ('Reset failed; perhaps a bad email address?' )
158
158
return redirect (url_for ('request_reset' ))
159
159
160
- @app .route ('/progcom/ user/login/<key>/' )
160
+ @app .route ('/user/login/<key>/' )
161
161
def view_reset_key (key ):
162
162
uid = l .test_login_string (key )
163
163
if not uid :
@@ -167,36 +167,36 @@ def view_reset_key(key):
167
167
flash ('Logged in!' )
168
168
return redirect (url_for ('reset_password' ))
169
169
170
- @app .route ('/progcom/ me/change_password/' )
170
+ @app .route ('/me/change_password/' )
171
171
def reset_password ():
172
172
return render_template ('user/reset_password.html' )
173
173
174
174
175
- @app .route ('/progcom/ me/change_password/' , methods = ['POST' ])
175
+ @app .route ('/me/change_password/' , methods = ['POST' ])
176
176
def reset_password_post ():
177
177
l .change_pw (request .user .id , request .values .get ('pw' ))
178
178
flash ('Password changed' )
179
- return redirect ('/progcom/ ' )
179
+ return redirect ('/' )
180
180
181
181
"""
182
182
User State
183
183
"""
184
- @app .route ('/progcom/ votes/' )
184
+ @app .route ('/votes/' )
185
185
def show_votes ():
186
186
votes = l .get_my_votes (request .user .id )
187
187
votes = [x ._replace (updated_on = l ._js_time (x .updated_on )) for x in votes ]
188
188
percent = l .get_vote_percentage (request .user .email , request .user .id )
189
189
return render_template ('my_votes.html' , votes = votes , percent = percent ,
190
190
standards = l .get_standards ())
191
191
192
- @app .route ('/progcom/ unread/' )
192
+ @app .route ('/unread/' )
193
193
def show_unread ():
194
194
return render_template ('unread.html' , unread = l .get_unread (request .user .id ))
195
195
196
196
"""
197
197
Batch Actions
198
198
"""
199
- @app .route ('/progcom/ batch/' )
199
+ @app .route ('/batch/' )
200
200
def batch_splash_page ():
201
201
groups = [x ._asdict () for x in l .list_groups (request .user .id )]
202
202
unread = l .get_unread_batches (request .user .id )
@@ -207,20 +207,20 @@ def batch_splash_page():
207
207
percent = int ( 100.0 * sum (1.0 for x in groups if x ['voted' ]) / len (groups ))
208
208
return render_template ('batch/batch.html' , groups = groups , percent = percent )
209
209
210
- @app .route ('/progcom/ batch/full/<int:id>/' )
210
+ @app .route ('/batch/full/<int:id>/' )
211
211
def view_single_proposals (id ):
212
212
proposal = l .get_proposal (id )
213
213
if request .user .email in [x .email for x in proposal .authors ]:
214
214
abort (404 )
215
215
return render_template ('batch/single_proposal.html' , proposal = proposal ,
216
216
discussion = l .get_discussion (id ))
217
217
218
- @app .route ('/progcom/ batch/full/' )
218
+ @app .route ('/batch/full/' )
219
219
def full_list ():
220
220
return render_template ('batch/full_list.html' ,
221
221
proposals = l .full_proposal_list (request .user .email ))
222
222
223
- @app .route ('/progcom/ batch/<int:id>/' )
223
+ @app .route ('/batch/<int:id>/' )
224
224
def batch_view (id ):
225
225
l .l ('batch_view' , uid = request .user .id , gid = id )
226
226
group = l .get_group (id )
@@ -252,7 +252,7 @@ def batch_view(id):
252
252
all_votes = votes ,
253
253
vote = vote ._asdict () if vote else None )
254
254
255
- @app .route ('/progcom/ batch/<int:id>/vote/' , methods = ['POST' ])
255
+ @app .route ('/batch/<int:id>/vote/' , methods = ['POST' ])
256
256
def batch_vote (id ):
257
257
group = l .get_group (id )
258
258
if request .user .email in group .author_emails or group .locked :
@@ -263,7 +263,7 @@ def batch_vote(id):
263
263
l .vote_group (id , request .user .id , accept )
264
264
return redirect (url_for ('batch_view' , id = id ))
265
265
266
- @app .route ('/progcom/ batch/<int:id>/comment/' , methods = ['POST' ])
266
+ @app .route ('/batch/<int:id>/comment/' , methods = ['POST' ])
267
267
def batch_discussion (id ):
268
268
group = l .get_group (id )
269
269
if request .user .email in group .author_emails or group .locked :
@@ -274,20 +274,20 @@ def batch_discussion(id):
274
274
return render_template ('batch/batch_discussion_snippet.html' ,
275
275
msgs = l .get_batch_messages (id ))
276
276
277
- @app .route ('/progcom/ batch/nominations/' )
277
+ @app .route ('/batch/nominations/' )
278
278
def my_nominations ():
279
279
return render_template ('batch/my_pycon.html' ,
280
280
proposals = l .get_my_pycon (request .user .id ))
281
281
282
282
"""
283
283
Screening Actions
284
284
"""
285
- @app .route ('/progcom/ activity_buttons/' )
285
+ @app .route ('/activity_buttons/' )
286
286
def activity_buttons ():
287
287
return render_template ('activity_button_fragment.html' )
288
288
289
289
290
- @app .route ('/progcom/ screening/stats/' )
290
+ @app .route ('/screening/stats/' )
291
291
def screening_stats ():
292
292
users = [x for x in l .list_users () if x .votes ]
293
293
users .sort (key = lambda x :- x .votes )
@@ -305,7 +305,7 @@ def screening_stats():
305
305
active_discussions = active_discussions ,
306
306
votes_when = votes_when )
307
307
308
- @app .route ('/progcom/ screening/<int:id>/' )
308
+ @app .route ('/screening/<int:id>/' )
309
309
def screening (id ):
310
310
l .l ('screening_view' , uid = request .user .id , id = id )
311
311
proposal = l .get_proposal (id )
@@ -333,7 +333,7 @@ def screening(id):
333
333
unread = unread ,
334
334
percent = percent )
335
335
336
- @app .route ('/progcom/ screening/<int:id>/vote/' , methods = ['POST' ])
336
+ @app .route ('/screening/<int:id>/vote/' , methods = ['POST' ])
337
337
def vote (id ):
338
338
standards = l .get_standards ()
339
339
scores = {}
@@ -346,7 +346,7 @@ def vote(id):
346
346
votes = l .get_votes (id ),
347
347
existing_vote = l .get_user_vote (request .user .id , id ))
348
348
349
- @app .route ('/progcom/ screening/<int:id>/comment/' , methods = ['POST' ])
349
+ @app .route ('/screening/<int:id>/comment/' , methods = ['POST' ])
350
350
def comment (id ):
351
351
comment = request .values .get ('comment' ).strip ()
352
352
if comment :
@@ -355,7 +355,7 @@ def comment(id):
355
355
unread = l .is_unread (request .user .id , id ),
356
356
discussion = l .get_discussion (id ))
357
357
358
- @app .route ('/progcom/ screening/<int:id>/feedback/' , methods = ['POST' ])
358
+ @app .route ('/screening/<int:id>/feedback/' , methods = ['POST' ])
359
359
def feedback (id ):
360
360
if CUTOFF_FEEDBACK :
361
361
abort (404 )
@@ -366,14 +366,14 @@ def feedback(id):
366
366
unread = l .is_unread (request .user .id , id ),
367
367
discussion = l .get_discussion (id ))
368
368
369
- @app .route ('/progcom/ screening/<int:id>/mark_read/' , methods = ['POST' ])
369
+ @app .route ('/screening/<int:id>/mark_read/' , methods = ['POST' ])
370
370
def mark_read (id ):
371
371
l .mark_read (request .user .id , id )
372
372
return render_template ('discussion_snippet.html' ,
373
373
unread = l .is_unread (request .user .id , id ),
374
374
discussion = l .get_discussion (id ))
375
375
376
- @app .route ('/progcom/ screening/<int:id>/mark_read/next/' , methods = ['POST' ])
376
+ @app .route ('/screening/<int:id>/mark_read/next/' , methods = ['POST' ])
377
377
def mark_read_read_next (id ):
378
378
l .mark_read (request .user .id , id )
379
379
unread = l .get_unread (request .user .id )
@@ -387,7 +387,7 @@ def mark_read_read_next(id):
387
387
Author Feedback
388
388
"""
389
389
390
- @app .route ('/progcom/ feedback/<key>' )
390
+ @app .route ('/feedback/<key>' )
391
391
def author_feedback (key ):
392
392
name , id = l .check_author_key (key )
393
393
if not name :
@@ -397,7 +397,7 @@ def author_feedback(key):
397
397
proposal = proposal , messages = l .get_discussion (id ))
398
398
399
399
400
- @app .route ('/progcom/ feedback/<key>' , methods = ['POST' ])
400
+ @app .route ('/feedback/<key>' , methods = ['POST' ])
401
401
def author_post_feedback (key ):
402
402
if CUTOFF_FEEDBACK :
403
403
abort (404 )
@@ -416,15 +416,15 @@ def author_post_feedback(key):
416
416
Observer View
417
417
"""
418
418
419
- @app .route ('/progcom/ schedule/' )
419
+ @app .route ('/schedule/' )
420
420
def view_schedule ():
421
421
return render_template ('admin/schedule.html' , schedule = l .get_schedule (),
422
422
talks = l .get_accepted (), read_only = True )
423
423
424
424
"""
425
425
Confirmation
426
426
"""
427
- @app .route ('/progcom/ confirmation/<key>/' )
427
+ @app .route ('/confirmation/<key>/' )
428
428
def confirmation (key ):
429
429
id = l .acknowledge_confirmation (key )
430
430
if not id :
@@ -435,7 +435,7 @@ def confirmation(key):
435
435
"""
436
436
Default Action
437
437
"""
438
- @app .route ('/progcom/ ' )
438
+ @app .route ('/' )
439
439
def pick ():
440
440
if THIS_IS_BATCH :
441
441
return redirect (url_for ('batch_splash_page' ))
0 commit comments