Repository: oppia/oppia

Issue:
Remove get_redirect_route() in main.py, if possible
In main.py, in the urls list at the bottom, there's a get_redirect_route() function which is somewhat confusing. For one thing, the third argument to this function is not used at all. It would be nice to find a simpler way of doing this.

One obvious idea is to give the "name" argument in get_redirect_route() a default value, but we'd need to check if it's OK for different routes to have the same name. Or maybe we can generate the name from the regex route somehow. Or maybe we can just get rid of get_redirect_route() altogether, and find another, cleaner way to achieve the same effect.

The main thing to check is that all tests still pass (including e2e ones) and that a request to /foo/ gets handled the same way as a request to /foo.

EDIT: To be clear, the idea behind this issue is to get rid of the third argument to get_redirect_route, which we don't really use and is therefore superfluous. One possibility might be to get rid of the whole get_redirect_route function itself, but if doing so means that stuff needs to be duplicated on all the lines, then let's not do that, since it violates the DRY principle.

/cc @charisseysabel 



Discussion:
@raman-balyan -- not sure if @ishankhare07 is still working on this. Would you like to have a go?

@seanlip This is my first open source project. A bit nervous but ready to take it, if @ishankhare07 is not working....

OK, go for it! :) If you need help, feel free to ask on the gitter chat.

Sure :)

Hi @raman-balyan -- any luck?

(De-assigning @raman-balyan due to lack of response.)

Hi @yjli216 did you fix this? If so then please could you merge the current develop branch into your branch, and then create a PR so someone can review your code. Thanks!

Hey! @yjli216 -- Ping ?

(Deassigning @yjli216 due to lack of response.)

@Andimeo, want to take this on? Note prior work in #1726 (though this doesn't take the right approach).


Resolving patch:
diff --git a/main.py b/main.py
--- a/main.py
+++ b/main.py
@@ -74,7 +74,7 @@ def get(self):
             self.redirect(feconf.SPLASH_URL)
 
 
-def get_redirect_route(regex_route, handler, name, defaults=None):
+def get_redirect_route(regex_route, handler, defaults=None):
     """Returns a route that redirects /foo/ to /foo.
 
     Warning: this method strips off parameters after the trailing slash. URLs
@@ -82,6 +82,7 @@ def get_redirect_route(regex_route, handler, name, defaults=None):
     """
     if defaults is None:
         defaults = {}
+    name = regex_route.replace('/', '_')
     return RedirectRoute(
         regex_route, handler, name, strict_slash=True, defaults=defaults)
 
@@ -134,297 +135,220 @@ def ui_access_wrapper(self, *args, **kwargs):
 # Tell map/reduce internals that this is now the base path to use.
 mapreduce_parameters.config.BASE_PATH = '/mapreduce/worker'
 
-
 # Register the URLs with the classes responsible for handling them.
 URLS = MAPREDUCE_HANDLERS + [
-    get_redirect_route(r'/_ah/warmup', WarmupHandler, 'warmup_handler'),
+    get_redirect_route(r'/_ah/warmup', WarmupHandler),
 
-    get_redirect_route(feconf.SPLASH_URL, pages.SplashPage, 'splash_page'),
-    get_redirect_route(r'/about', pages.AboutPage, 'about_page'),
+    get_redirect_route(feconf.SPLASH_URL, pages.SplashPage),
+    get_redirect_route(r'/about', pages.AboutPage),
     get_redirect_route(
-        r'/foundation', pages.AboutRedirectPage, 'about_redirect_page_1'),
+        r'/foundation', pages.AboutRedirectPage),
     get_redirect_route(
-        r'/credits', pages.AboutRedirectPage, 'about_redirect_page_2'),
-    get_redirect_route(r'/teach', pages.TeachPage, 'teach_page'),
+        r'/credits', pages.AboutRedirectPage),
+    get_redirect_route(r'/teach', pages.TeachPage),
     get_redirect_route(
-        r'/participate', pages.TeachRedirectPage, 'teach_redirect_page_1'),
+        r'/participate', pages.TeachRedirectPage),
     get_redirect_route(
-        r'/site_guidelines', pages.TeachRedirectPage, 'teach_redirect_page_2'),
+        r'/site_guidelines', pages.TeachRedirectPage),
     get_redirect_route(
-        r'/console_errors', pages.ConsoleErrorPage, 'console_errors'),
-    get_redirect_route(r'/contact', pages.ContactPage, 'contact_page'),
+        r'/console_errors', pages.ConsoleErrorPage),
+    get_redirect_route(r'/contact', pages.ContactPage),
 
-    get_redirect_route(r'/forum', pages.ForumPage, 'forum_page'),
-    get_redirect_route(r'/donate', pages.DonatePage, 'donate_page'),
-    get_redirect_route(r'/thanks', pages.ThanksPage, 'thanks_page'),
-    get_redirect_route(r'/terms', pages.TermsPage, 'terms_page'),
-    get_redirect_route(r'/privacy', pages.PrivacyPage, 'privacy_page'),
+    get_redirect_route(r'/forum', pages.ForumPage),
+    get_redirect_route(r'/donate', pages.DonatePage),
+    get_redirect_route(r'/thanks', pages.ThanksPage),
+    get_redirect_route(r'/terms', pages.TermsPage),
+    get_redirect_route(r'/privacy', pages.PrivacyPage),
 
-    get_redirect_route(r'%s' % feconf.ADMIN_URL, admin.AdminPage, 'admin_page'),
-    get_redirect_route(r'/adminhandler', admin.AdminHandler, 'admin_handler'),
+    get_redirect_route(r'%s' % feconf.ADMIN_URL, admin.AdminPage),
+    get_redirect_route(r'/adminhandler', admin.AdminHandler),
     get_redirect_route(
-        r'/adminjoboutput', admin.AdminJobOutput, 'admin_job_output'),
+        r'/adminjoboutput', admin.AdminJobOutput),
     get_redirect_route(
         r'/admintopicscsvdownloadhandler',
-        admin.AdminTopicsCsvDownloadHandler,
-        'admin_topics_csv_download_handler'),
+        admin.AdminTopicsCsvDownloadHandler),
 
     get_redirect_route(
-        r'/notifications_dashboard', dashboard.NotificationsDashboardPage,
-        'notifications_dashboard_handler'),
+        r'/notifications_dashboard', dashboard.NotificationsDashboardPage),
     get_redirect_route(
         r'/notificationsdashboardhandler/data',
-        dashboard.NotificationsDashboardHandler,
-        'notifications_dashboard_handler'),
+        dashboard.NotificationsDashboardHandler),
     get_redirect_route(
-        r'/notificationshandler', dashboard.NotificationsHandler,
-        'notifications_handler'),
+        r'/notificationshandler', dashboard.NotificationsHandler),
     get_redirect_route(
-        r'%s' % feconf.DASHBOARD_URL, dashboard.DashboardPage,
-        'dashboard_page'),
+        r'%s' % feconf.DASHBOARD_URL, dashboard.DashboardPage),
     get_redirect_route(
-        r'%s' % feconf.DASHBOARD_DATA_URL, dashboard.DashboardHandler,
-        'dashboard_handler'),
+        r'%s' % feconf.DASHBOARD_DATA_URL, dashboard.DashboardHandler),
     get_redirect_route(
-        r'%s' % feconf.NEW_EXPLORATION_URL,
-        dashboard.NewExploration, 'new_exploration'),
+        r'%s' % feconf.NEW_EXPLORATION_URL, dashboard.NewExploration),
     get_redirect_route(
-        r'%s' % feconf.NEW_COLLECTION_URL,
-        dashboard.NewCollection, 'new_collection'),
+        r'%s' % feconf.NEW_COLLECTION_URL, dashboard.NewCollection),
     get_redirect_route(
-        r'%s' % feconf.UPLOAD_EXPLORATION_URL,
-        dashboard.UploadExploration, 'upload_exploration'),
+        r'%s' % feconf.UPLOAD_EXPLORATION_URL, dashboard.UploadExploration),
     get_redirect_route(
-        r'/my_explorations', dashboard.DashboardRedirectPage,
-        'dashboard_redirect_page'),
+        r'/my_explorations', dashboard.DashboardRedirectPage),
 
-    get_redirect_route(
-        r'/imagehandler/<exploration_id>/<encoded_filepath>',
-        resources.ImageHandler, 'image_handler'),
-    get_redirect_route(
-        r'/object_editor_template/<obj_type>',
-        resources.ObjectEditorTemplateHandler, 'object_editor_template'),
-    get_redirect_route(
-        r'/value_generator_handler/<generator_id>',
-        resources.ValueGeneratorHandler, 'value_generator_handler'),
+    get_redirect_route(r'/imagehandler/<exploration_id>/<encoded_filepath>',
+                       resources.ImageHandler),
+    get_redirect_route(r'/object_editor_template/<obj_type>',
+                       resources.ObjectEditorTemplateHandler),
+    get_redirect_route(r'/value_generator_handler/<generator_id>',
+                       resources.ValueGeneratorHandler),
 
-    get_redirect_route(r'/', HomePageRedirectHandler, 'home_page'),
+    get_redirect_route(r'/', HomePageRedirectHandler),
 
-    get_redirect_route(
-        r'%s' % feconf.LIBRARY_INDEX_URL, library.LibraryPage,
-        'library_index_page'),
-    get_redirect_route(
-        r'/libraryindexhandler', library.LibraryIndexHandler,
-        'library_index_handler'),
-    get_redirect_route(
-        r'%s' % feconf.LIBRARY_SEARCH_URL, library.LibraryPage,
-        'library_search_page'),
-    get_redirect_route(
-        r'%s' % feconf.LIBRARY_SEARCH_DATA_URL, library.SearchHandler,
-        'library_search_handler'),
-    get_redirect_route(
-        r'/gallery', library.LibraryRedirectPage, 'old_gallery_page_1'),
-    get_redirect_route(
-        r'/contribute', library.LibraryRedirectPage, 'old_gallery_page_2'),
-    get_redirect_route(
-        r'/learn', library.LibraryRedirectPage, 'old_gallery_page_3'),
-    get_redirect_route(
-        r'/playtest', library.LibraryRedirectPage, 'old_gallery_page_4'),
-    get_redirect_route(
-        feconf.EXPLORATION_SUMMARIES_DATA_URL,
-        library.ExplorationSummariesHandler,
-        'exploration_summaries_handler'),
+    get_redirect_route(r'%s' % feconf.LIBRARY_INDEX_URL, library.LibraryPage),
+    get_redirect_route(r'/libraryindexhandler', library.LibraryIndexHandler),
+    get_redirect_route(r'%s' % feconf.LIBRARY_SEARCH_URL, library.LibraryPage),
+    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'/learn', library.LibraryRedirectPage),
+    get_redirect_route(r'/playtest', library.LibraryRedirectPage),
+    get_redirect_route(feconf.EXPLORATION_SUMMARIES_DATA_URL,
+                       library.ExplorationSummariesHandler),
 
-    get_redirect_route(
-        r'/profile/<username>', profile.ProfilePage, 'profile_page'),
-    get_redirect_route(
-        r'/profilehandler/data/<username>', profile.ProfileHandler,
-        'profile_handler'),
-    get_redirect_route(
-        r'/preferences', profile.PreferencesPage, 'preferences_page'),
-    get_redirect_route(
-        r'/preferenceshandler/data', profile.PreferencesHandler,
-        'preferences_handler'),
-    get_redirect_route(
-        r'/preferenceshandler/profile_picture', profile.ProfilePictureHandler,
-        'profle_picture_handler'),
+    get_redirect_route(r'/profile/<username>', profile.ProfilePage),
+    get_redirect_route(r'/profilehandler/data/<username>',
+                       profile.ProfileHandler),
+    get_redirect_route(r'/preferences', profile.PreferencesPage),
+    get_redirect_route(r'/preferenceshandler/data',
+                       profile.PreferencesHandler),
+    get_redirect_route(r'/preferenceshandler/profile_picture',
+                       profile.ProfilePictureHandler),
     get_redirect_route(
         r'/preferenceshandler/profile_picture_by_username/<username>',
-        profile.ProfilePictureHandlerByUsername,
-        'profile_picture_handler_by_username'),
-    get_redirect_route(
-        r'%s' % feconf.SIGNUP_URL, profile.SignupPage, 'signup_page'),
-    get_redirect_route(
-        r'%s' % feconf.SIGNUP_DATA_URL, profile.SignupHandler,
-        'signup_handler'),
-    get_redirect_route(
-        r'%s' % feconf.USERNAME_CHECK_DATA_URL,
-        profile.UsernameCheckHandler, 'username_check_handler'),
-    get_redirect_route(
-        r'%s' % feconf.SITE_LANGUAGE_DATA_URL,
-        profile.SiteLanguageHandler, 'save_site_language'),
-
-    get_redirect_route(
-        r'/moderator', moderator.ModeratorPage, 'moderator_page'),
-    get_redirect_route(
-        r'/moderatorhandler/featured', moderator.FeaturedActivitiesHandler,
-        'moderator_featured_activities'),
-    get_redirect_route(
-        r'/moderatorhandler/email_draft/<action>',
-        moderator.EmailDraftHandler, 'moderator_action_email_draft'),
-
-    get_redirect_route(
-        r'%s/<exploration_id>' % feconf.EXPLORATION_URL_PREFIX,
-        reader.ExplorationPage, 'exploration_page'),
-    get_redirect_route(
-        r'%s/<exploration_id>' % feconf.EXPLORATION_INIT_URL_PREFIX,
-        reader.ExplorationHandler, 'exploration_handler'),
-    get_redirect_route(
-        r'/explorehandler/exploration_start_event/<exploration_id>',
-        reader.ExplorationStartEventHandler,
-        'exploration_start_event_handler'),
-    get_redirect_route(
-        r'/explorehandler/state_hit_event/<exploration_id>',
-        reader.StateHitEventHandler, 'state_hit_event_handler'),
+        profile.ProfilePictureHandlerByUsername),
+    get_redirect_route(r'%s' % feconf.SIGNUP_URL, profile.SignupPage),
+    get_redirect_route(r'%s' % feconf.SIGNUP_DATA_URL, profile.SignupHandler),
+    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'/moderator', moderator.ModeratorPage),
+    get_redirect_route(r'/moderatorhandler/featured',
+                       moderator.FeaturedActivitiesHandler),
+    get_redirect_route(r'/moderatorhandler/email_draft/<action>',
+                       moderator.EmailDraftHandler),
+
+    get_redirect_route(r'%s/<exploration_id>' % feconf.EXPLORATION_URL_PREFIX,
+                       reader.ExplorationPage),
+    get_redirect_route(r'%s/<exploration_id>' %
+                       feconf.EXPLORATION_INIT_URL_PREFIX,
+                       reader.ExplorationHandler),
+    get_redirect_route(
+        '/explorehandler/exploration_start_event/<exploration_id>',
+        reader.ExplorationStartEventHandler),
+    get_redirect_route(r'/explorehandler/state_hit_event/<exploration_id>',
+                       reader.StateHitEventHandler),
     get_redirect_route(
         r'/explorehandler/answer_submitted_event/<exploration_id>',
-        reader.AnswerSubmittedEventHandler, 'answer_submitted_event_handler'),
-    get_redirect_route(
-        r'/explorehandler/give_feedback/<exploration_id>',
-        reader.ReaderFeedbackHandler, 'reader_feedback_handler'),
+        reader.AnswerSubmittedEventHandler),
+    get_redirect_route(r'/explorehandler/give_feedback/<exploration_id>',
+                       reader.ReaderFeedbackHandler),
     get_redirect_route(
         r'/explorehandler/exploration_complete_event/<exploration_id>',
-        reader.ExplorationCompleteEventHandler, 'reader_complete_handler'),
+        reader.ExplorationCompleteEventHandler),
     get_redirect_route(
         r'/explorehandler/exploration_maybe_leave_event/<exploration_id>',
-        reader.ExplorationMaybeLeaveHandler, 'reader_leave_handler'),
-    get_redirect_route(
-        r'/explorehandler/classify/<exploration_id>', reader.ClassifyHandler,
-        'reader_classify_handler'),
-    get_redirect_route(
-        r'/explorehandler/rating/<exploration_id>',
-        reader.RatingHandler, 'rating_handler'),
-    get_redirect_route(
-        r'/explorehandler/recommendations/<exploration_id>',
-        reader.RecommendationsHandler, 'recommendations_handler'),
-
-    get_redirect_route(
-        r'%s/<exploration_id>' % feconf.EDITOR_URL_PREFIX,
-        editor.ExplorationPage, 'editor_exploration_page'),
-    get_redirect_route(
-        r'/createhandler/data/<exploration_id>', editor.ExplorationHandler,
-        'editor_exploration_handler'),
-    get_redirect_route(
-        r'/createhandler/download/<exploration_id>',
-        editor.ExplorationDownloadHandler, 'exploration_download_handler'),
-    get_redirect_route(
-        r'/createhandler/imageupload/<exploration_id>',
-        editor.ImageUploadHandler, 'image_upload_handler'),
-    get_redirect_route(
-        r'/createhandler/resolved_answers/<exploration_id>/' +
-        r'<escaped_state_name>',
-        editor.ResolvedAnswersHandler, 'resolved_answers_handler'),
-    get_redirect_route(
-        r'/createhandler/state_yaml', editor.StateYamlHandler,
-        'state_yaml_handler'),
+        reader.ExplorationMaybeLeaveHandler),
+    get_redirect_route(r'/explorehandler/classify/<exploration_id>',
+                       reader.ClassifyHandler),
+    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/<exploration_id>' % feconf.EDITOR_URL_PREFIX,
+                       editor.ExplorationPage),
+    get_redirect_route(r'/createhandler/data/<exploration_id>',
+                       editor.ExplorationHandler),
+    get_redirect_route(r'/createhandler/download/<exploration_id>',
+                       editor.ExplorationDownloadHandler),
+    get_redirect_route(r'/createhandler/imageupload/<exploration_id>',
+                       editor.ImageUploadHandler),
+    get_redirect_route(r'/createhandler/resolved_answers/<exploration_id>/' +
+                       r'<escaped_state_name>',
+                       editor.ResolvedAnswersHandler),
+    get_redirect_route(r'/createhandler/state_yaml', editor.StateYamlHandler),
     get_redirect_route(
         r'/createhandler/training_data/<exploration_id>/<escaped_state_name>',
-        editor.UntrainedAnswersHandler, 'training_data_handler'),
-    get_redirect_route(
-        r'/createhandler/resource_list/<exploration_id>',
-        editor.ExplorationResourcesHandler, 'exploration_resources_handler'),
-    get_redirect_route(
-        r'/createhandler/revert/<exploration_id>',
-        editor.ExplorationRevertHandler, 'exploration_revert_handler'),
+        editor.UntrainedAnswersHandler),
+    get_redirect_route(r'/createhandler/resource_list/<exploration_id>',
+                       editor.ExplorationResourcesHandler),
+    get_redirect_route(r'/createhandler/revert/<exploration_id>',
+                       editor.ExplorationRevertHandler),
     get_redirect_route(
         r'%s/<exploration_id>' % feconf.EXPLORATION_RIGHTS_PREFIX,
-        editor.ExplorationRightsHandler, 'exploration_rights_handler'),
-    get_redirect_route(
-        r'/createhandler/moderatorrights/<exploration_id>',
-        editor.ExplorationModeratorRightsHandler,
-        'exploration_moderator_rights_handler'),
-    get_redirect_route(
-        r'/createhandler/snapshots/<exploration_id>',
-        editor.ExplorationSnapshotsHandler, 'exploration_snapshots_handler'),
-    get_redirect_route(
-        r'/createhandler/statisticsversion/<exploration_id>',
-        editor.ExplorationStatsVersionsHandler,
-        'exploration_stats_versions_handler'),
+        editor.ExplorationRightsHandler),
+    get_redirect_route(r'/createhandler/moderatorrights/<exploration_id>',
+                       editor.ExplorationModeratorRightsHandler),
+    get_redirect_route(r'/createhandler/snapshots/<exploration_id>',
+                       editor.ExplorationSnapshotsHandler),
+    get_redirect_route(r'/createhandler/statisticsversion/<exploration_id>',
+                       editor.ExplorationStatsVersionsHandler),
     get_redirect_route(
         r'/createhandler/statistics/<exploration_id>/<exploration_version>',
-        editor.ExplorationStatisticsHandler, 'exploration_statistics_handler'),
-    get_redirect_route(
-        r'/createhandler/state_rules_stats/<exploration_id>/' +
-        r'<escaped_state_name>',
-        editor.StateRulesStatsHandler, 'state_rules_stats_handler'),
-    get_redirect_route(
-        r'/createhandler/started_tutorial_event',
-        editor.StartedTutorialEventHandler, 'started_tutorial_event_handler'),
-    get_redirect_route(
-        r'/createhandler/autosave_draft/<exploration_id>',
-        editor.EditorAutosaveHandler, 'editor_autosave_handler'),
-
-    get_redirect_route(
-        r'%s' % feconf.RECENT_COMMITS_DATA_URL,
-        recent_commits.RecentCommitsHandler, 'recent_commits_handler'),
-    get_redirect_route(
-        r'%s' % feconf.RECENT_FEEDBACK_MESSAGES_DATA_URL,
-        feedback.RecentFeedbackMessagesHandler,
-        'recent_feedback_messages_handler'),
-
-    get_redirect_route(
-        r'%s' % feconf.FEEDBACK_THREAD_VIEW_EVENT_URL,
-        feedback.FeedbackThreadViewEventHandler, 'feedback_thread_view_event'),
-    get_redirect_route(
-        r'%s/<exploration_id>' % feconf.FEEDBACK_THREADLIST_URL_PREFIX,
-        feedback.ThreadListHandler, 'feedback_threadlist_handler'),
-    get_redirect_route(
-        r'%s/<exploration_id>/<thread_id>' % feconf.FEEDBACK_THREAD_URL_PREFIX,
-        feedback.ThreadHandler, 'feedback_thread_handler'),
-    get_redirect_route(
-        r'%s/<exploration_id>' % feconf.FEEDBACK_STATS_URL_PREFIX,
-        feedback.FeedbackStatsHandler, 'feedback_stats_handler'),
-    get_redirect_route(
-        r'%s/<exploration_id>' % feconf.SUGGESTION_URL_PREFIX,
-        feedback.SuggestionHandler, 'suggestion_handler'),
-    get_redirect_route(
-        r'%s/<exploration_id>' % feconf.FLAG_EXPLORATION_URL_PREFIX,
-        reader.FlagExplorationHandler, 'flag_exploration_handler'),
-    get_redirect_route(
-        r'%s/<exploration_id>/<thread_id>' %
-        feconf.SUGGESTION_ACTION_URL_PREFIX,
-        feedback.SuggestionActionHandler, 'suggestion_action_handler'),
-    get_redirect_route(
-        r'%s/<exploration_id>' % feconf.SUGGESTION_LIST_URL_PREFIX,
-        feedback.SuggestionListHandler, 'suggestion_list_handler'),
-
-    get_redirect_route(
-        r'%s/<collection_id>' % feconf.COLLECTION_URL_PREFIX,
-        collection_viewer.CollectionPage, 'collection_page'),
-    get_redirect_route(
-        r'%s/<collection_id>' % feconf.COLLECTION_DATA_URL_PREFIX,
-        collection_viewer.CollectionDataHandler, 'collection_data_handler'),
-
-    get_redirect_route(
-        r'%s/<collection_id>' % feconf.COLLECTION_EDITOR_URL_PREFIX,
-        collection_editor.CollectionEditorPage, 'collection_editor_page'),
-    get_redirect_route(
-        r'%s/<collection_id>' % feconf.COLLECTION_WRITABLE_DATA_URL_PREFIX,
-        collection_editor.WritableCollectionDataHandler,
-        'writable_collection_data_handler'),
-    get_redirect_route(
-        r'%s/<collection_id>' % feconf.COLLECTION_RIGHTS_PREFIX,
-        collection_editor.CollectionRightsHandler,
-        'collection_rights_handler'),
-
-    get_redirect_route(
-        r'/frontend_errors', FrontendErrorHandler, 'frontend_error_handler'),
-
-    get_redirect_route(
-        r'/logout', base.LogoutPage, 'logout_page_handler'),
+        editor.ExplorationStatisticsHandler),
+    get_redirect_route(r'/createhandler/state_rules_stats/<exploration_id>/' +
+                       r'<escaped_state_name>',
+                       editor.StateRulesStatsHandler),
+    get_redirect_route(r'/createhandler/started_tutorial_event',
+                       editor.StartedTutorialEventHandler),
+    get_redirect_route(r'/createhandler/autosave_draft/<exploration_id>',
+                       editor.EditorAutosaveHandler),
+
+    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' % 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/<exploration_id>/<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/<exploration_id>' % feconf.SUGGESTION_URL_PREFIX,
+                       feedback.SuggestionHandler),
+    get_redirect_route(r'%s/<exploration_id>' %
+                       feconf.FLAG_EXPLORATION_URL_PREFIX,
+                       reader.FlagExplorationHandler),
+    get_redirect_route(r'%s/<exploration_id>/<thread_id>' %
+                       feconf.SUGGESTION_ACTION_URL_PREFIX,
+                       feedback.SuggestionActionHandler),
+    get_redirect_route(r'%s/<exploration_id>' %
+                       feconf.SUGGESTION_LIST_URL_PREFIX,
+                       feedback.SuggestionListHandler),
+
+    get_redirect_route(r'%s/<collection_id>' % feconf.COLLECTION_URL_PREFIX,
+                       collection_viewer.CollectionPage),
+    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_URL_PREFIX,
+                       collection_editor.CollectionEditorPage),
+    get_redirect_route(r'%s/<collection_id>' %
+                       feconf.COLLECTION_WRITABLE_DATA_URL_PREFIX,
+                       collection_editor.WritableCollectionDataHandler),
+    get_redirect_route(r'%s/<collection_id>' % feconf.COLLECTION_RIGHTS_PREFIX,
+                       collection_editor.CollectionRightsHandler),
+
+    get_redirect_route(r'/frontend_errors', FrontendErrorHandler),
+
+    get_redirect_route(r'/logout', base.LogoutPage),
 
     # 404 error handler.
-    get_redirect_route(r'/<:.*>', base.Error404Handler, 'error_404_handler'),
+    get_redirect_route(r'/<:.*>', base.Error404Handler),
 ]
 
 app = transaction_services.toplevel_wrapper(  # pylint: disable=invalid-name
diff --git a/main_cron.py b/main_cron.py
--- a/main_cron.py
+++ b/main_cron.py
@@ -28,22 +28,17 @@
 # Register the URLs with the classes responsible for handling them.
 URLS = [
     main.get_redirect_route(
-        r'/cron/mail/admin/job_status', cron.JobStatusMailerHandler,
-        'job_failure_mailer'),
+        r'/cron/mail/admin/job_status', cron.JobStatusMailerHandler),
     main.get_redirect_route(
-        r'/cron/users/dashboard_stats', cron.CronDashboardStatsHandler,
-        'job_creator_dashboard_stats'),
+        r'/cron/users/dashboard_stats', cron.CronDashboardStatsHandler),
     main.get_redirect_route(
         r'/cron/explorations/recommendations',
-        cron.CronExplorationRecommendationsHandler,
-        'exploration_recommendations_handler'),
+        cron.CronExplorationRecommendationsHandler),
     main.get_redirect_route(
         r'/cron/explorations/search_rank',
-        cron.CronExplorationSearchRankHandler,
-        'exploration_search_rank_handler'),
+        cron.CronExplorationSearchRankHandler),
     main.get_redirect_route(
-        r'/cron/jobs/cleanup', cron.CronMapreduceCleanupHandler,
-        'job_cleanup_handler'),
+        r'/cron/jobs/cleanup', cron.CronMapreduceCleanupHandler),
 ]
 
 app = transaction_services.toplevel_wrapper(  # pylint: disable=invalid-name
diff --git a/main_taskqueue.py b/main_taskqueue.py
--- a/main_taskqueue.py
+++ b/main_taskqueue.py
@@ -30,23 +30,19 @@
 URLS = [
     main.get_redirect_route(
         r'%s' % feconf.TASK_URL_FEEDBACK_MESSAGE_EMAILS,
-        tasks.UnsentFeedbackEmailHandler,
-        'feedback_message_email_task_handler'),
+        tasks.UnsentFeedbackEmailHandler),
     main.get_redirect_route(
         r'%s' % feconf.TASK_URL_SUGGESTION_EMAILS,
-        tasks.SuggestionEmailHandler,
-        'suggestion_email_task_handler'),
+        tasks.SuggestionEmailHandler),
     main.get_redirect_route(
         r'%s' % feconf.TASK_URL_FLAG_EXPLORATION_EMAILS,
-        tasks.FlagExplorationEmailHandler, 'flag_exploration_email_handler'),
+        tasks.FlagExplorationEmailHandler),
     main.get_redirect_route(
         r'%s' % feconf.TASK_URL_INSTANT_FEEDBACK_EMAILS,
-        tasks.InstantFeedbackMessageEmailHandler,
-        'instant_feedback_message_email_task_handler'),
+        tasks.InstantFeedbackMessageEmailHandler),
     main.get_redirect_route(
         r'%s' % feconf.TASK_URL_FEEDBACK_STATUS_EMAILS,
-        tasks.FeedbackThreadStatusChangeEmailHandler,
-        'feedback_thread_status_change_email_task_handler'),
+        tasks.FeedbackThreadStatusChangeEmailHandler),
 ]
 
 app = transaction_services.toplevel_wrapper(  # pylint: disable=invalid-name


Test patch: