forked from oppia/oppia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
1361 lines (1257 loc) · 54.4 KB
/
main.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Copyright 2014 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""URL routing definitions, and some basic error/warmup handlers."""
from __future__ import annotations
import logging
from core import android_validation_constants
from core import feconf
from core.constants import constants
from core.controllers import access_validators
from core.controllers import acl_decorators
from core.controllers import admin
from core.controllers import android
from core.controllers import base
from core.controllers import beam_jobs
from core.controllers import blog_admin
from core.controllers import blog_dashboard
from core.controllers import blog_homepage
from core.controllers import classifier
from core.controllers import classroom
from core.controllers import collection_editor
from core.controllers import collection_viewer
from core.controllers import concept_card_viewer
from core.controllers import contributor_dashboard
from core.controllers import contributor_dashboard_admin
from core.controllers import creator_dashboard
from core.controllers import cron
from core.controllers import custom_landing_pages
from core.controllers import diagnostic_test_player
from core.controllers import editor
from core.controllers import email_dashboard
from core.controllers import feature_flag
from core.controllers import features
from core.controllers import feedback
from core.controllers import feedback_updates
from core.controllers import firebase
from core.controllers import improvements
from core.controllers import incoming_app_feedback_report
from core.controllers import learner_dashboard
from core.controllers import learner_goals
from core.controllers import learner_group
from core.controllers import learner_playlist
from core.controllers import library
from core.controllers import moderator
from core.controllers import oppia_root
from core.controllers import pages
from core.controllers import practice_sessions
from core.controllers import profile
from core.controllers import question_editor
from core.controllers import questions_list
from core.controllers import reader
from core.controllers import recent_commits
from core.controllers import release_coordinator
from core.controllers import resources
from core.controllers import review_tests
from core.controllers import skill_editor
from core.controllers import skill_mastery
from core.controllers import story_editor
from core.controllers import story_viewer
from core.controllers import subscriptions
from core.controllers import subtopic_viewer
from core.controllers import suggestion
from core.controllers import tasks
from core.controllers import topic_editor
from core.controllers import topic_viewer
from core.controllers import topics_and_skills_dashboard
from core.controllers import voice_artist
from core.controllers import voiceover
from core.platform import models
from core.platform.auth import firebase_auth_services
import google.cloud.logging
from typing import Dict, Optional, Type, TypeVar
import webapp2
from webapp2_extras import routes
MYPY = False
if MYPY: # pragma: no cover
from mypy_imports import datastore_services
from mypy_imports import memory_cache_services as cache_services
T = TypeVar('T') # pylint: disable=invalid-name
cache_services = models.Registry.import_cache_services()
datastore_services = models.Registry.import_datastore_services()
# Cloud Logging is disabled in emulator mode, since it is unnecessary and
# creates a lot of noise.
if not constants.EMULATOR_MODE:
# Instantiates a client and rtrieves a Cloud Logging handler based on the
# environment you're running in and integrates the handler with the Python
# logging module.
client = google.cloud.logging.Client()
client.setup_logging()
# Suppress debug logging for chardet. See https://stackoverflow.com/a/48581323.
# Without this, a lot of unnecessary debug logs are printed in error logs,
# which makes it tiresome to identify the actual error.
logging.getLogger(name='chardet.charsetprober').setLevel(logging.INFO)
class InternetConnectivityHandler(
base.BaseHandler[Dict[str, str], Dict[str, str]]
):
"""Handles the get request to the server from the
frontend to check for internet connection."""
GET_HANDLER_ERROR_RETURN_TYPE = feconf.HANDLER_TYPE_JSON
URL_PATH_ARGS_SCHEMAS: Dict[str, str] = {}
HANDLER_ARGS_SCHEMAS: Dict[str, Dict[str, str]] = {'GET': {}}
@acl_decorators.open_access
def get(self) -> None:
"""Handles GET requests."""
self.render_json({'is_internet_connected': True})
class FrontendErrorHandler(
base.BaseHandler[Dict[str, str], Dict[str, str]]
):
"""Handles errors arising from the frontend."""
REQUIRE_PAYLOAD_CSRF_CHECK = False
URL_PATH_ARGS_SCHEMAS: Dict[str, str] = {}
HANDLER_ARGS_SCHEMAS = {
'POST': {
'error': {
'schema': {
'type': 'basestring'
}
}
}
}
@acl_decorators.open_access
def post(self) -> None:
"""Records errors reported by the frontend."""
assert self.normalized_payload is not None
logging.error(
'Frontend error: %s' % self.normalized_payload.get('error')
)
self.render_json(self.values)
class WarmupPage(
base.BaseHandler[Dict[str, str], Dict[str, str]]
):
"""Handles warmup requests."""
GET_HANDLER_ERROR_RETURN_TYPE = feconf.HANDLER_TYPE_HTML
URL_PATH_ARGS_SCHEMAS: Dict[str, str] = {}
HANDLER_ARGS_SCHEMAS: Dict[str, Dict[str, str]] = {'GET': {}}
@acl_decorators.open_access
def get(self) -> None:
"""Handles GET warmup requests."""
pass
class SplashRedirectPage(
base.BaseHandler[Dict[str, str], Dict[str, str]]
):
"""Redirect the old splash URL, '/splash' to the new one, '/'."""
GET_HANDLER_ERROR_RETURN_TYPE = feconf.HANDLER_TYPE_HTML
URL_PATH_ARGS_SCHEMAS: Dict[str, str] = {}
HANDLER_ARGS_SCHEMAS: Dict[str, Dict[str, str]] = {'GET': {}}
@acl_decorators.open_access
def get(self) -> None:
self.redirect('/')
# Type for `defaults` is set to Dict[str, str] based on the usage in our
# backend. Should be changed in future as per the requirements.
def get_redirect_route(
regex_route: str,
handler: Type[webapp2.RequestHandler],
defaults: Optional[Dict[str, str]] = None
) -> routes.RedirectRoute:
"""Returns a route that redirects /foo/ to /foo.
Warning: this method strips off parameters after the trailing slash. URLs
with parameters should be formulated without the trailing slash.
Args:
regex_route: unicode. A raw string representing a route.
handler: RequestHandler. A callable to handle the route.
defaults: dict. Optional defaults parameter to be passed
into the RedirectRoute object.
Returns:
RedirectRoute. A RedirectRoute object for redirects.
"""
if defaults is None:
defaults = {}
name = regex_route.replace('/', '_')
return routes.RedirectRoute(
regex_route, handler, name, strict_slash=True, defaults=defaults)
# Register the URLs with the classes responsible for handling them.
URLS = [
get_redirect_route(
'/<firebase_path:__/auth(?:/.*)?>',
firebase.FirebaseProxyPage
),
get_redirect_route(r'/_ah/warmup', WarmupPage),
get_redirect_route(r'/splash', SplashRedirectPage),
get_redirect_route(
r'/internetconnectivityhandler', InternetConnectivityHandler),
get_redirect_route(r'/credits', pages.AboutRedirectPage),
get_redirect_route(r'/participate', pages.TeachRedirectPage),
get_redirect_route(r'/site_guidelines', pages.TeachRedirectPage),
get_redirect_route(r'/forum', pages.ForumRedirectPage),
# Access Validators.
get_redirect_route(
r'%s/can_access_classroom_page' %
feconf.ACCESS_VALIDATION_HANDLER_PREFIX,
access_validators.ClassroomAccessValidationHandler),
get_redirect_route(
r'%s/can_access_classrooms_page' %
feconf.ACCESS_VALIDATION_HANDLER_PREFIX,
access_validators.ClassroomsPageAccessValidationHandler
),
get_redirect_route(
r'%s/can_access_collection_editor_page/<collection_id>' %
feconf.ACCESS_VALIDATION_HANDLER_PREFIX,
access_validators.CollectionEditorAccessValidationPage
),
get_redirect_route(
r'%s/can_access_story_editor_page/<story_id>' %
feconf.ACCESS_VALIDATION_HANDLER_PREFIX,
access_validators.StoryEditorAccessValidationHandlerPage
),
get_redirect_route(
r'%s/can_access_blog_home_page' %
feconf.ACCESS_VALIDATION_HANDLER_PREFIX,
access_validators.BlogHomePageAccessValidationHandler),
get_redirect_route(
r'%s/can_access_subtopic_viewer_page/<classroom_url_fragment>/<topic_url_fragment>/revision/<subtopic_url_fragment>' % # pylint: disable=line-too-long
feconf.ACCESS_VALIDATION_HANDLER_PREFIX,
access_validators.SubtopicViewerPageAccessValidationHandler),
get_redirect_route(
r'%s/can_access_blog_post_page' %
feconf.ACCESS_VALIDATION_HANDLER_PREFIX,
access_validators.BlogPostPageAccessValidationHandler),
get_redirect_route(
r'%s/can_access_blog_author_profile_page/<author_username>' %
feconf.ACCESS_VALIDATION_HANDLER_PREFIX,
access_validators.BlogAuthorProfilePageAccessValidationHandler),
get_redirect_route(
r'%s/can_manage_own_account' % feconf.ACCESS_VALIDATION_HANDLER_PREFIX,
access_validators.ManageOwnAccountValidationHandler),
get_redirect_route(
r'%s/does_profile_exist/<username>' %
feconf.ACCESS_VALIDATION_HANDLER_PREFIX,
access_validators.ProfileExistsValidationHandler),
get_redirect_route(
r'%s/can_access_release_coordinator_page' %
feconf.ACCESS_VALIDATION_HANDLER_PREFIX,
access_validators.ReleaseCoordinatorAccessValidationHandler
),
get_redirect_route(
r'%s/can_access_facilitator_dashboard_page' %
feconf.ACCESS_VALIDATION_HANDLER_PREFIX,
access_validators.FacilitatorDashboardPageAccessValidationHandler
),
get_redirect_route(
r'%s/can_access_create_learner_group_page' %
feconf.ACCESS_VALIDATION_HANDLER_PREFIX,
access_validators.CreateLearnerGroupPageAccessValidationHandler
),
get_redirect_route(
r'%s/can_access_edit_learner_group_page/<learner_group_id>' %
feconf.ACCESS_VALIDATION_HANDLER_PREFIX,
access_validators.EditLearnerGroupPageAccessValidationHandler
),
get_redirect_route(
r'%s/does_learner_group_exist/<learner_group_id>' %
feconf.ACCESS_VALIDATION_HANDLER_PREFIX,
access_validators.ViewLearnerGroupPageAccessValidationHandler),
get_redirect_route(
r'%s/can_access_collection_player_page/<collection_id>' %
feconf.ACCESS_VALIDATION_HANDLER_PREFIX,
access_validators.CollectionViewerPageAccessValidationHandler),
get_redirect_route(
r'%s/can_access_diagnostic_test_player_page' %
feconf.ACCESS_VALIDATION_HANDLER_PREFIX,
access_validators.DiagnosticTestPlayerAccessValidationHandler
),
get_redirect_route(
r'%s/can_access_topic_viewer_page/<classroom_url_fragment>'
r'/<topic_url_fragment>' %
feconf.ACCESS_VALIDATION_HANDLER_PREFIX,
access_validators.TopicViewerPageAccessValidationHandler
),
get_redirect_route(
r'%s/can_access_topic_viewer_page/<classroom_url_fragment>'
r'/<topic_url_fragment>/story' %
feconf.ACCESS_VALIDATION_HANDLER_PREFIX,
access_validators.TopicViewerPageAccessValidationHandler
),
get_redirect_route(
r'%s/can_access_topic_viewer_page/<classroom_url_fragment>'
r'/<topic_url_fragment>/revision' %
feconf.ACCESS_VALIDATION_HANDLER_PREFIX,
access_validators.TopicViewerPageAccessValidationHandler
),
get_redirect_route(
r'%s/can_access_topic_viewer_page/<classroom_url_fragment>'
r'/<topic_url_fragment>/practice' %
feconf.ACCESS_VALIDATION_HANDLER_PREFIX,
access_validators.TopicViewerPageAccessValidationHandler
),
get_redirect_route(r'%s' % feconf.ADMIN_URL, oppia_root.OppiaRootPage),
get_redirect_route(r'/adminhandler', admin.AdminHandler),
get_redirect_route(r'/adminrolehandler', admin.AdminRoleHandler),
get_redirect_route(r'/bannedusershandler', admin.BannedUsersHandler),
get_redirect_route(
r'/topicmanagerrolehandler', admin.TopicManagerRoleHandler),
get_redirect_route(
r'/translationcoordinatorrolehandler',
admin.TranslationCoordinatorRoleHandler),
get_redirect_route(
r'/adminsuperadminhandler', admin.AdminSuperAdminPrivilegesHandler),
get_redirect_route(
r'/admintopicscsvdownloadhandler',
admin.AdminTopicsCsvFileDownloader),
get_redirect_route(
r'/updateblogpostdatahandler', admin.UpdateBlogPostHandler),
get_redirect_route(
r'%s' % feconf.REGENERATE_TOPIC_SUMMARIES_URL,
admin.RegenerateTopicSummariesHandler),
get_redirect_route(
r'/contributionrightshandler/<category>',
contributor_dashboard_admin.ContributionRightsHandler),
get_redirect_route(
r'/getcontributorusershandler/<category>',
contributor_dashboard_admin.ContributorUsersListHandler),
get_redirect_route(
r'/contributionrightsdatahandler',
contributor_dashboard_admin.ContributionRightsDataHandler),
get_redirect_route(
r'%s/<contribution_type>/<contribution_subtype>' % (
feconf.CONTRIBUTOR_DASHBOARD_ADMIN_STATS_URL_PREFIX),
contributor_dashboard_admin.ContributorDashboardAdminStatsHandler),
get_redirect_route(
r'%s' % (feconf.COMMUNITY_CONTRIBUTION_STATS_URL),
contributor_dashboard_admin.CommunityContributionStatsHandler),
get_redirect_route(
r'/translationcontributionstatshandler',
contributor_dashboard_admin.TranslationContributionStatsHandler),
get_redirect_route(
r'%s' % feconf.CONTRIBUTOR_DASHBOARD_URL,
contributor_dashboard.ContributorDashboardPage),
get_redirect_route(
r'%s/<contribution_type>/<contribution_subtype>/<username>' % (
feconf.CONTRIBUTOR_STATS_SUMMARIES_URL),
contributor_dashboard.ContributorStatsSummariesHandler),
get_redirect_route(
r'%s/<username>' % feconf.CONTRIBUTOR_ALL_STATS_SUMMARIES_URL,
contributor_dashboard.ContributorAllStatsSummariesHandler),
get_redirect_route(
r'%s/<username>/<suggestion_type>' % (
feconf.CONTRIBUTOR_CERTIFICATE_URL),
contributor_dashboard.ContributorCertificateHandler),
get_redirect_route(
'/contributor_dashboard',
creator_dashboard.OldContributorDashboardRedirectPage),
get_redirect_route(
'/creator_dashboard',
creator_dashboard.OldCreatorDashboardRedirectPage),
get_redirect_route(
r'%s' % feconf.CREATOR_DASHBOARD_URL,
creator_dashboard.CreatorDashboardPage),
get_redirect_route(
r'%s' % feconf.CREATOR_DASHBOARD_DATA_URL,
creator_dashboard.CreatorDashboardHandler),
get_redirect_route(
r'%s' % feconf.NEW_EXPLORATION_URL,
creator_dashboard.NewExplorationHandler),
get_redirect_route(
r'%s' % feconf.NEW_COLLECTION_URL,
creator_dashboard.NewCollectionHandler),
get_redirect_route(
r'%s' % feconf.FRACTIONS_LANDING_PAGE_URL,
custom_landing_pages.FractionLandingRedirectPage),
get_redirect_route(
r'/learn/maths/<topic>', custom_landing_pages.TopicLandingRedirectPage),
get_redirect_route(
r'%s/<opportunity_type>' % feconf.CONTRIBUTOR_OPPORTUNITIES_DATA_URL,
contributor_dashboard.ContributionOpportunitiesHandler),
get_redirect_route(
r'/preferredtranslationlanguage',
contributor_dashboard.TranslationPreferenceHandler),
get_redirect_route(
r'%s' % feconf.REVIEWABLE_OPPORTUNITIES_URL,
contributor_dashboard.ReviewableOpportunitiesHandler),
get_redirect_route(
r'%s' % feconf.PINNED_OPPORTUNITIES_URL,
contributor_dashboard.LessonsPinningHandler,
),
get_redirect_route(
r'/gettranslatabletexthandler',
contributor_dashboard.TranslatableTextHandler),
get_redirect_route(
r'%s' % feconf.MACHINE_TRANSLATION_DATA_URL,
contributor_dashboard.MachineTranslationStateTextsHandler),
get_redirect_route(
r'/usercontributionrightsdatahandler',
contributor_dashboard.UserContributionRightsDataHandler),
get_redirect_route(
r'/retrievefeaturedtranslationlanguages',
contributor_dashboard.FeaturedTranslationLanguagesHandler),
get_redirect_route(
r'/gettranslatabletopicnames',
contributor_dashboard.TranslatableTopicNamesHandler),
get_redirect_route(
r'%s' % feconf.NEW_SKILL_URL,
topics_and_skills_dashboard.NewSkillHandler),
get_redirect_route(
r'%s' % feconf.NEW_QUESTION_URL,
question_editor.QuestionCreationHandler),
get_redirect_route(
r'%s/<comma_separated_skill_ids>' % feconf.QUESTIONS_LIST_URL_PREFIX,
questions_list.QuestionsListHandler),
get_redirect_route(
r'%s/<comma_separated_skill_ids>' % feconf.QUESTION_COUNT_URL_PREFIX,
questions_list.QuestionCountDataHandler),
get_redirect_route(
r'%s/practice/session' % feconf.TOPIC_VIEWER_URL_PREFIX,
practice_sessions.PracticeSessionsPage),
get_redirect_route(
r'%s/<classroom_url_fragment>/<topic_url_fragment>' %
feconf.PRACTICE_SESSION_DATA_URL_PREFIX,
practice_sessions.PracticeSessionsPageDataHandler),
get_redirect_route(
r'%s/<classroom_url_fragment>/<topic_url_fragment>'
r'/<story_url_fragment>' % feconf.REVIEW_TEST_DATA_URL_PREFIX,
review_tests.ReviewTestsPageDataHandler),
get_redirect_route(
r'%s/can_access_review_tests_page/<classroom_url_fragment>'
r'/<topic_url_fragment>/<story_url_fragment>'
% feconf.ACCESS_VALIDATION_HANDLER_PREFIX,
access_validators.ReviewTestsPageAccessValidationHandler),
get_redirect_route(
r'%s/<classroom_url_fragment>/<topic_url_fragment>'
r'/<story_url_fragment>' % feconf.STORY_DATA_HANDLER,
story_viewer.StoryPageDataHandler),
get_redirect_route(
r'%s/<story_url_fragment>' % feconf.STORY_URL_FRAGMENT_HANDLER,
story_editor.StoryUrlFragmentHandler),
get_redirect_route(
r'%s/<topic_name>' % feconf.TOPIC_NAME_HANDLER,
topic_editor.TopicNameHandler),
get_redirect_route(
r'%s/<topic_url_fragment>' % feconf.TOPIC_URL_FRAGMENT_HANDLER,
topic_editor.TopicUrlFragmentHandler),
get_redirect_route(
r'%s/<skill_description>' % feconf.SKILL_DESCRIPTION_HANDLER,
skill_editor.SkillDescriptionHandler),
get_redirect_route(
r'%s/<skill_id>' % feconf.DIAGNOSTIC_TEST_SKILL_ASSIGNMENT_HANDLER,
skill_editor.DiagnosticTestSkillAssignmentHandler),
get_redirect_route(
r'%s/' %
feconf.TOPIC_ID_TO_DIAGNOSTIC_TEST_SKILL_IDS_HANDLER,
topics_and_skills_dashboard.TopicIdToDiagnosticTestSkillIdsHandler),
get_redirect_route(
r'%s/<topic_id>' % feconf.DIAGNOSTIC_TEST_QUESTIONS_HANDLER_URL,
diagnostic_test_player.DiagnosticTestQuestionsHandler
),
get_redirect_route(
r'%s' % feconf.CLASSROOM_DISPLAY_INFO_HANDLER_URL,
classroom.ClassroomDisplayInfoHandler),
get_redirect_route(
r'%s' % feconf.UPDATE_CLASSROOMS_ORDER_HANDLER_URL,
classroom.UpdateClassroomIndexMappingHandler),
get_redirect_route(
r'%s' % feconf.UNUSED_TOPICS_HANDLER_URL,
classroom.UnusedTopicsHandler),
get_redirect_route(
r'%s' % feconf.NEW_CLASSROOM_ID_HANDLER_URL,
classroom.NewClassroomIdHandler),
get_redirect_route(
r'%s' % feconf.NEW_CLASSROOM_HANDLER_URL,
classroom.NewClassroomHandler),
get_redirect_route(
r'%s' % feconf.TOPICS_TO_CLASSROOM_RELATION_HANDLER_URL,
classroom.TopicsToClassroomsRelationHandler),
get_redirect_route(
r'%s' % feconf.ALL_CLASSROOMS_SUMMARY_HANDLER_URL,
classroom.AllClassroomsSummaryHandler),
get_redirect_route(
r'%s/<classroom_id>' % feconf.CLASSROOM_HANDLER_URL,
classroom.ClassroomHandler),
get_redirect_route(
r'%s/<classroom_url_fragment>' % feconf.CLASSROOM_URL_FRAGMENT_HANDLER,
classroom.ClassroomUrlFragmentHandler),
get_redirect_route(
r'%s/<classroom_url_fragment>' % feconf.CLASSROOM_ID_HANDLER_URL,
classroom.ClassroomIdHandler
),
get_redirect_route(
r'%s' % feconf.VOICEOVER_ADMIN_DATA_HANDLER_URL,
voiceover.VoiceoverAdminDataHandler
),
get_redirect_route(
r'%s' % feconf.VOICEOVER_LANGUAGE_CODES_MAPPING_HANDLER_URL,
voiceover.VoiceoverLanguageCodesMappingHandler
),
get_redirect_route(
r'%s' % feconf.VOICE_ARTIST_METADATA_HANDLER,
voiceover.VoiceArtistMetadataHandler
),
get_redirect_route(
r'%s/<voice_artist_id>/<language_code>' %
feconf.GET_SAMPLE_VOICEOVERS_FOR_VOICE_ARTIST,
voiceover.GetSampleVoiceoversForGivenVoiceArtistHandler
),
get_redirect_route(
r'/entity_voiceovers_bulk_handler/<entity_type>/<entity_id>/'
r'<entity_version>/<language_code>',
voiceover.EntityVoiceoversBulkHandler
),
get_redirect_route(
r'%s/<classroom_url_fragment>/<topic_url_fragment>'
r'/<story_url_fragment>/<node_id>' % feconf.STORY_PROGRESS_URL_PREFIX,
story_viewer.StoryProgressHandler),
get_redirect_route(
r'%s/<classroom_url_fragment>/<topic_url_fragment>'
r'/<subtopic_url_fragment>' % feconf.SUBTOPIC_DATA_HANDLER,
subtopic_viewer.SubtopicPageDataHandler),
get_redirect_route(
r'%s/<topic_id>' % feconf.TOPIC_EDITOR_STORY_URL,
topic_editor.TopicEditorStoryHandler),
get_redirect_route(
r'%s/<classroom_url_fragment>/<topic_url_fragment>'
% feconf.TOPIC_DATA_HANDLER,
topic_viewer.TopicPageDataHandler),
get_redirect_route(
r'%s/<classroom_url_fragment>' % feconf.CLASSROOM_DATA_HANDLER,
classroom.ClassroomDataHandler),
get_redirect_route(
r'%s' % feconf.NEW_TOPIC_URL,
topics_and_skills_dashboard.NewTopicHandler),
get_redirect_route(
r'%s' % feconf.UPLOAD_EXPLORATION_URL,
creator_dashboard.UploadExplorationHandler),
get_redirect_route(
'/learner_dashboard',
learner_dashboard.OldLearnerDashboardRedirectPage),
get_redirect_route(
r'%s' % feconf.LEARNER_DASHBOARD_TOPIC_AND_STORY_DATA_URL,
learner_dashboard.LearnerDashboardTopicsAndStoriesProgressHandler),
get_redirect_route(
r'%s' % feconf.LEARNER_COMPLETED_CHAPTERS_COUNT_DATA_URL,
learner_dashboard.LearnerCompletedChaptersCountHandler),
get_redirect_route(
r'%s' % feconf.LEARNER_DASHBOARD_COLLECTION_DATA_URL,
learner_dashboard.LearnerDashboardCollectionsProgressHandler),
get_redirect_route(
r'%s' % feconf.LEARNER_DASHBOARD_EXPLORATION_DATA_URL,
learner_dashboard.LearnerDashboardExplorationsProgressHandler),
get_redirect_route(
r'%s' % feconf.FEEDBACK_UPDATES_DATA_URL,
feedback_updates.FeedbackUpdatesHandler),
get_redirect_route(
r'%s' % feconf.LEARNER_DASHBOARD_IDS_DATA_URL,
learner_dashboard.LearnerDashboardIdsHandler),
get_redirect_route(
r'%s/<thread_id>' %
feconf.FEEDBACK_UPDATES_THREAD_DATA_URL,
feedback_updates.FeedbackThreadHandler),
get_redirect_route(
r'%s' % feconf.TOPICS_AND_SKILLS_DASHBOARD_URL,
topics_and_skills_dashboard.TopicsAndSkillsDashboardPage),
get_redirect_route(
r'%s' % feconf.MERGE_SKILLS_URL,
topics_and_skills_dashboard.MergeSkillHandler),
get_redirect_route(
r'%s' % feconf.TOPICS_AND_SKILLS_DASHBOARD_DATA_URL,
topics_and_skills_dashboard.TopicsAndSkillsDashboardPageDataHandler),
get_redirect_route(
r'%s/<skill_id>' % feconf.UNASSIGN_SKILL_DATA_HANDLER_URL,
topics_and_skills_dashboard.TopicAssignmentsHandler),
get_redirect_route(
r'%s' % feconf.SKILL_DASHBOARD_DATA_URL,
topics_and_skills_dashboard.SkillsDashboardPageDataHandler),
get_redirect_route(
r'%s/<activity_type>/<activity_id>' %
feconf.LEARNER_INCOMPLETE_ACTIVITY_DATA_URL,
reader.LearnerIncompleteActivityHandler),
get_redirect_route(
r'%s/<activity_type>/<topic_id>' % feconf.LEARNER_GOALS_DATA_URL,
learner_goals.LearnerGoalsHandler),
get_redirect_route(
r'%s/<activity_type>/<activity_id>' % feconf.LEARNER_PLAYLIST_DATA_URL,
learner_playlist.LearnerPlaylistHandler),
get_redirect_route(
r'%s/<blog_post_url>' % feconf.BLOG_HOMEPAGE_DATA_URL,
blog_homepage.BlogPostDataHandler),
get_redirect_route(
r'%s/<author_username>' %
feconf.BLOG_AUTHOR_PROFILE_PAGE_DATA_URL_PREFIX,
blog_homepage.AuthorsPageHandler),
get_redirect_route(
r'%s' % feconf.BLOG_HOMEPAGE_DATA_URL,
blog_homepage.BlogHomepageDataHandler),
get_redirect_route(
r'%s' % feconf.BLOG_SEARCH_DATA_URL,
blog_homepage.BlogPostSearchHandler),
get_redirect_route(
r'/assetsdevhandler/<page_context>/<page_identifier>/'
'assets/<asset_type:(image|audio|thumbnail)>/<encoded_filename>',
resources.AssetDevHandler),
get_redirect_route(
r'/value_generator_handler/<generator_id>',
resources.ValueGeneratorHandler),
get_redirect_route(r'/promo_bar_handler', resources.PromoBarHandler),
get_redirect_route('/library', library.OldLibraryRedirectPage),
get_redirect_route(
r'%s' % feconf.LIBRARY_INDEX_DATA_URL, library.LibraryIndexHandler),
get_redirect_route(
r'%s' % feconf.LIBRARY_GROUP_DATA_URL,
library.LibraryGroupIndexHandler),
get_redirect_route(
r'%s' % feconf.LIBRARY_SEARCH_DATA_URL, library.SearchHandler),
get_redirect_route(r'/gallery', library.LibraryRedirectPage),
get_redirect_route(r'/contribute', library.LibraryRedirectPage),
get_redirect_route(r'/playtest', library.LibraryRedirectPage),
get_redirect_route(
feconf.EXPLORATION_SUMMARIES_DATA_URL,
library.ExplorationSummariesHandler),
get_redirect_route(
feconf.COLLECTION_SUMMARIES_DATA_URL,
library.CollectionSummariesHandler),
get_redirect_route(
r'/profilehandler/data/<username>', profile.ProfileHandler),
get_redirect_route(
r'/mailinglistsubscriptionhandler',
profile.MailingListSubscriptionHandler),
get_redirect_route(
r'%s/<secret>' % feconf.BULK_EMAIL_WEBHOOK_ENDPOINT,
profile.BulkEmailWebhookEndpoint),
get_redirect_route(
feconf.PREFERENCES_DATA_URL, profile.PreferencesHandler),
get_redirect_route(r'%s' % feconf.SIGNUP_URL, profile.SignupPage),
get_redirect_route(r'%s' % feconf.SIGNUP_DATA_URL, profile.SignupHandler),
get_redirect_route(
feconf.DELETE_ACCOUNT_HANDLER_URL, profile.DeleteAccountHandler),
get_redirect_route(
feconf.EXPORT_ACCOUNT_HANDLER_URL, profile.ExportAccountHandler),
get_redirect_route(
r'%s' % feconf.USERNAME_CHECK_DATA_URL, profile.UsernameCheckHandler),
get_redirect_route(
r'%s' % feconf.SITE_LANGUAGE_DATA_URL, profile.SiteLanguageHandler),
get_redirect_route(r'/userinfohandler', profile.UserInfoHandler),
get_redirect_route(r'/userinfohandler/data', profile.UserInfoHandler),
get_redirect_route(r'/url_handler', profile.UrlHandler),
get_redirect_route(
r'/moderatorhandler/featured', moderator.FeaturedActivitiesHandler),
get_redirect_route(
r'/moderatorhandler/email_draft', moderator.EmailDraftHandler),
get_redirect_route(
r'/memorycachehandler', release_coordinator.MemoryCacheHandler),
get_redirect_route(
r'%s' % feconf.FEATURE_FLAGS_URL,
release_coordinator.FeatureFlagsHandler),
get_redirect_route(
r'%s' % feconf.USER_GROUPS_HANDLER_URL,
release_coordinator.UserGroupHandler),
get_redirect_route(
r'%s/<exploration_id>' % feconf.EXPLORATION_URL_PREFIX,
reader.ExplorationPage),
get_redirect_route(
r'%s/<exploration_id>' % feconf.EXPLORATION_URL_EMBED_PREFIX,
reader.ExplorationEmbedPage),
get_redirect_route(
r'%s/<exploration_id>' % feconf.EXPLORATION_INIT_URL_PREFIX,
reader.ExplorationHandler),
get_redirect_route(
r'%s/<exploration_id>' % feconf.EXPLORATION_PRETESTS_URL_PREFIX,
reader.PretestHandler),
get_redirect_route(
r'%s/<exploration_id>' % feconf.EXPLORATION_FEATURES_PREFIX,
features.ExplorationFeaturesHandler),
get_redirect_route(
'/explorehandler/exploration_start_event/<exploration_id>',
reader.ExplorationStartEventHandler),
get_redirect_route(
'/explorehandler/exploration_actual_start_event/<exploration_id>',
reader.ExplorationActualStartEventHandler),
get_redirect_route(
'/explorehandler/solution_hit_event/<exploration_id>',
reader.SolutionHitEventHandler),
get_redirect_route(
'/sync_logged_out_and_logged_in_progress/<exploration_id>',
reader.SyncLoggedOutLearnerProgressHandler),
get_redirect_route(
r'/explorehandler/state_hit_event/<exploration_id>',
reader.StateHitEventHandler),
get_redirect_route(
r'/explorehandler/state_complete_event/<exploration_id>',
reader.StateCompleteEventHandler),
get_redirect_route(
r'/explorehandler/checkpoint_reached_by_logged_out_user/<exploration_id>', # pylint: disable=line-too-long
reader.SaveTransientCheckpointProgressHandler),
get_redirect_route(
'/progress/<unique_progress_url_id>',
reader.TransientCheckpointUrlPage),
get_redirect_route(
r'/explorehandler/leave_for_refresher_exp_event/<exploration_id>',
reader.LeaveForRefresherExpEventHandler),
get_redirect_route(
r'/explorehandler/answer_submitted_event/<exploration_id>',
reader.AnswerSubmittedEventHandler),
get_redirect_route(
r'/explorehandler/checkpoint_reached/<exploration_id>',
reader.CheckpointReachedEventHandler),
get_redirect_route(
r'/explorehandler/restart/<exploration_id>',
reader.ExplorationRestartEventHandler),
get_redirect_route(
r'/explorehandler/give_feedback/<exploration_id>',
reader.ReaderFeedbackHandler),
get_redirect_route(
r'/explorehandler/exploration_complete_event/<exploration_id>',
reader.ExplorationCompleteEventHandler),
get_redirect_route(
r'/explorehandler/exploration_maybe_leave_event/<exploration_id>',
reader.ExplorationMaybeLeaveHandler),
get_redirect_route(
r'/explorehandler/stats_events/<exploration_id>',
reader.StatsEventsHandler),
get_redirect_route(
r'/explorehandler/store_playthrough/<exploration_id>',
reader.StorePlaythroughHandler),
get_redirect_route(
r'/explorehandler/rating/<exploration_id>', reader.RatingHandler),
get_redirect_route(
r'/explorehandler/recommendations/<exploration_id>',
reader.RecommendationsHandler),
get_redirect_route(
r'%s/<entity_type>/<entity_id>' % (
feconf.LEARNER_ANSWER_DETAILS_SUBMIT_URL),
reader.LearnerAnswerDetailsSubmissionHandler),
get_redirect_route(
r'%s/<exploration_id>/<state_name>/<version>' % (
feconf.STATE_VERSION_HISTORY_URL_PREFIX
), reader.StateVersionHistoryHandler),
get_redirect_route(
r'%s/<exploration_id>/<version>' % (
feconf.METADATA_VERSION_HISTORY_URL_PREFIX
), reader.MetadataVersionHistoryHandler),
get_redirect_route(
r'%s/<question_id>' % feconf.QUESTION_EDITOR_DATA_URL_PREFIX,
question_editor.EditableQuestionDataHandler),
get_redirect_route(
r'%s/<exploration_id>' % feconf.EDITOR_URL_PREFIX,
editor.ExplorationPage),
get_redirect_route(
r'%s/<exploration_id>' % feconf.EXPLORATION_DATA_PREFIX,
editor.ExplorationHandler),
get_redirect_route(
r'/editsallowedhandler/<exploration_id>',
editor.ExplorationEditsAllowedHandler),
get_redirect_route(
r'/createhandler/download/<exploration_id>',
editor.ExplorationFileDownloader),
get_redirect_route(
r'%s/<entity_type>/<entity_id>' % (
feconf.EXPLORATION_IMAGE_UPLOAD_PREFIX),
editor.ImageUploadHandler),
get_redirect_route(
r'/createhandler/audioupload/<exploration_id>',
voice_artist.AudioUploadHandler),
get_redirect_route(
r'/createhandler/state_yaml/<exploration_id>',
editor.StateYamlHandler),
get_redirect_route(
r'/createhandler/check_revert_valid/<exploration_id>/<version>',
editor.ExplorationCheckRevertValidHandler),
get_redirect_route(
r'/createhandler/revert/<exploration_id>',
editor.ExplorationRevertHandler),
get_redirect_route(
r'%s/<exploration_id>' % feconf.EXPLORATION_RIGHTS_PREFIX,
editor.ExplorationRightsHandler),
get_redirect_route(
r'%s/<exploration_id>' % feconf.USER_PERMISSIONS_URL_PREFIX,
editor.UserExplorationPermissionsHandler),
get_redirect_route(
r'%s/<exploration_id>' % feconf.EXPLORATION_STATUS_PREFIX,
editor.ExplorationStatusHandler),
get_redirect_route(
r'/createhandler/moderatorrights/<exploration_id>',
editor.ExplorationModeratorRightsHandler),
get_redirect_route(
r'%s/<exploration_id>' % feconf.USER_EXPLORATION_EMAILS_PREFIX,
editor.UserExplorationEmailsHandler),
get_redirect_route(
r'/createhandler/snapshots/<exploration_id>',
editor.ExplorationSnapshotsHandler),
get_redirect_route(
r'/createhandler/statistics/<exploration_id>',
editor.ExplorationStatisticsHandler),
get_redirect_route(
r'/createhandler/state_interaction_stats/<exploration_id>/<state_name>',
editor.StateInteractionStatsHandler),
get_redirect_route(
r'%s/<exploration_id>' % feconf.EXPLORATION_STATE_ANSWER_STATS_PREFIX,
editor.StateAnswerStatisticsHandler),
get_redirect_route(
r'/createhandler/started_tutorial_event/<exploration_id>',
editor.StartedTutorialEventHandler),
get_redirect_route(
r'/createhandler/started_translation_tutorial_event/<exploration_id>',
voice_artist.StartedTranslationTutorialEventHandler),
get_redirect_route(
r'/createhandler/autosave_draft/<exploration_id>',
editor.EditorAutosaveHandler),
get_redirect_route(
r'/createhandler/get_top_unresolved_answers/<exploration_id>',
editor.TopUnresolvedAnswersHandler),
get_redirect_route(
r'%s/<entity_type>/<entity_id>' %
feconf.LEARNER_ANSWER_INFO_HANDLER_URL,
editor.LearnerAnswerInfoHandler),
get_redirect_route(
r'/entity_translations_bulk_handler/<entity_type>/<entity_id>/<entity_version>', # pylint: disable=line-too-long
editor.EntityTranslationsBulkHandler),
get_redirect_route(
r'%s' % feconf.RECENT_COMMITS_DATA_URL,
recent_commits.RecentCommitsHandler),
get_redirect_route(
r'%s' % feconf.RECENT_FEEDBACK_MESSAGES_DATA_URL,
feedback.RecentFeedbackMessagesHandler),
get_redirect_route(
r'%s/<thread_id>' % feconf.FEEDBACK_THREAD_VIEW_EVENT_URL,
feedback.FeedbackThreadViewEventHandler),
get_redirect_route(
r'%s/<exploration_id>' % feconf.FEEDBACK_THREADLIST_URL_PREFIX,
feedback.ThreadListHandler),
get_redirect_route(
r'%s/<topic_id>' % feconf.FEEDBACK_THREADLIST_URL_PREFIX_FOR_TOPICS,
feedback.ThreadListHandlerForTopicsHandler),
get_redirect_route(
r'%s/<thread_id>' % feconf.FEEDBACK_THREAD_URL_PREFIX,
feedback.ThreadHandler),
get_redirect_route(
r'%s/<exploration_id>' % feconf.FEEDBACK_STATS_URL_PREFIX,
feedback.FeedbackStatsHandler),
get_redirect_route(
r'%s/' % feconf.SUGGESTION_URL_PREFIX,
suggestion.SuggestionHandler),
get_redirect_route(
r'%s/<suggestion_id>' % feconf.UPDATE_TRANSLATION_SUGGESTION_URL_PREFIX,
suggestion.UpdateTranslationSuggestionHandler),
get_redirect_route(
r'%s/<suggestion_id>' % feconf.UPDATE_QUESTION_SUGGESTION_URL_PREFIX,
suggestion.UpdateQuestionSuggestionHandler),
get_redirect_route(
r'%s' % feconf.QUESTIONS_URL_PREFIX,
reader.QuestionPlayerHandler),
get_redirect_route(
r'%s/exploration/<target_id>/<suggestion_id>' %
feconf.SUGGESTION_ACTION_URL_PREFIX,
suggestion.SuggestionToExplorationActionHandler),
get_redirect_route(
r'%s/resubmit/<suggestion_id>' % feconf.SUGGESTION_ACTION_URL_PREFIX,
suggestion.ResubmitSuggestionHandler),
get_redirect_route(
r'%s/skill/<target_id>/<suggestion_id>' %
feconf.SUGGESTION_ACTION_URL_PREFIX,
suggestion.SuggestionToSkillActionHandler),
get_redirect_route(
r'%s' % feconf.SUGGESTION_LIST_URL_PREFIX,
suggestion.SuggestionListHandler),
get_redirect_route(
r'/getreviewablesuggestions/<target_type>/<suggestion_type>',
suggestion.ReviewableSuggestionsHandler),
get_redirect_route(
r'/getsubmittedsuggestions/<target_type>/<suggestion_type>',
suggestion.UserSubmittedSuggestionsHandler),
get_redirect_route(
r'%s' % feconf.SUBSCRIBE_URL_PREFIX,
subscriptions.SubscribeHandler),
get_redirect_route(
r'%s' % feconf.UNSUBSCRIBE_URL_PREFIX,
subscriptions.UnsubscribeHandler),
get_redirect_route(
r'%s/<exploration_id>' % feconf.FLAG_EXPLORATION_URL_PREFIX,
reader.FlagExplorationHandler),
get_redirect_route(
r'%s/<collection_id>' % feconf.COLLECTION_DATA_URL_PREFIX,
collection_viewer.CollectionDataHandler),
get_redirect_route(
r'%s/<collection_id>' % feconf.COLLECTION_EDITOR_DATA_URL_PREFIX,
collection_editor.EditableCollectionDataHandler),
get_redirect_route(
r'%s/<collection_id>' % feconf.COLLECTION_RIGHTS_PREFIX,
collection_editor.CollectionRightsHandler),
get_redirect_route(
r'%s/<collection_id>' % feconf.COLLECTION_PUBLISH_PREFIX,
collection_editor.CollectionPublishHandler),
get_redirect_route(
r'%s/<collection_id>' % feconf.COLLECTION_UNPUBLISH_PREFIX,
collection_editor.CollectionUnpublishHandler),
get_redirect_route(
r'%s/<topic_id>' % feconf.TOPIC_EDITOR_URL_PREFIX,
topic_editor.TopicEditorPage),
get_redirect_route(
r'%s/<topic_id>' % feconf.TOPIC_EDITOR_DATA_URL_PREFIX,
topic_editor.EditableTopicDataHandler),
get_redirect_route(
r'%s/<topic_id>/<subtopic_id>' %
feconf.SUBTOPIC_PAGE_EDITOR_DATA_URL_PREFIX,
topic_editor.EditableSubtopicPageDataHandler),
get_redirect_route(
r'%s/<topic_id>' % feconf.TOPIC_RIGHTS_URL_PREFIX,
topic_editor.TopicRightsHandler),
get_redirect_route(
r'%s/<topic_id>' % feconf.TOPIC_STATUS_URL_PREFIX,
topic_editor.TopicPublishHandler),
get_redirect_route(
r'%s/<topic_id>' % feconf.TOPIC_SEND_MAIL_URL_PREFIX,
topic_editor.TopicPublishSendMailHandler),
get_redirect_route(
r'%s/' % feconf.TOPIC_ID_TO_TOPIC_NAME,
topic_editor.TopicIdToTopicNameHandler),
get_redirect_route(
r'%s/<selected_skill_ids>' % feconf.CONCEPT_CARD_DATA_URL_PREFIX,
concept_card_viewer.ConceptCardDataHandler),
get_redirect_route(
r'%s/<question_id>' % feconf.QUESTION_SKILL_LINK_URL_PREFIX,
question_editor.QuestionSkillLinkHandler),
get_redirect_route(
r'%s/<comma_separated_skill_ids>' % feconf.SKILL_DATA_URL_PREFIX,
skill_editor.SkillDataHandler),
get_redirect_route(
r'%s' % feconf.FETCH_SKILLS_URL_PREFIX,
skill_editor.FetchSkillsHandler),
get_redirect_route(
r'%s/<skill_id>' % feconf.SKILL_EDITOR_URL_PREFIX,
skill_editor.SkillEditorPage),
get_redirect_route(