Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #5466: Added check to enforce that all name of controllers end with "Handler" or "Page" #5878

Merged
merged 12 commits into from
Nov 28, 2018
Merged
Prev Previous commit
Next Next commit
Check for class name test
  • Loading branch information
Rishav Chakraborty committed Nov 16, 2018
commit 41c3ff5a84363090f9fbe07f465d955c3ece2465
2 changes: 1 addition & 1 deletion core/controllers/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def post(self):
self.render_json({})


class AdminJobOutput(base.BaseHandler):
class AdminJobOutputHandler(base.BaseHandler):
"""Retrieves job output to show on the admin page."""

GET_HANDLER_ERROR_RETURN_TYPE = feconf.HANDLER_TYPE_JSON
Expand Down
1 change: 1 addition & 0 deletions core/controllers/concept_card_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from core.controllers import base
from core.domain import acl_decorators
from core.domain import skill_services
import feconf


class ConceptCardDataHandler(base.BaseHandler):
Expand Down
2 changes: 1 addition & 1 deletion core/controllers/creator_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ def post(self):
})


class UploadExploration(base.BaseHandler):
class UploadExplorationHandler(base.BaseHandler):
"""Uploads a new exploration."""

@acl_decorators.can_upload_exploration
Expand Down
2 changes: 1 addition & 1 deletion core/controllers/email_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def _validate(self, data):
raise self.InvalidInputException('400 Invalid input for query.')


class QueryStatusCheck(base.BaseHandler):
class QueryStatusCheckHandler(base.BaseHandler):
"""Handler for checking status of individual queries."""

GET_HANDLER_ERROR_RETURN_TYPE = feconf.HANDLER_TYPE_JSON
Expand Down
2 changes: 1 addition & 1 deletion core/controllers/feedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def post(self, exploration_id):
self.render_json(self.values)


class ThreadListHandlerForTopics(base.BaseHandler):
class ThreadListHandlerForTopicsHandler(base.BaseHandler):
"""Handles listing of suggestions threads linked to topics."""

GET_HANDLER_ERROR_RETURN_TYPE = feconf.HANDLER_TYPE_JSON
Expand Down
2 changes: 1 addition & 1 deletion core/controllers/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def get(self):
self.render_json(self.values)


class ProfilePictureHandlerByUsername(base.BaseHandler):
class ProfilePictureHandlerByUsernameHandler(base.BaseHandler):
""" Provides the dataURI of the profile picture of the specified user,
or None if no user picture is uploaded for the user with that ID.
"""
Expand Down
2 changes: 1 addition & 1 deletion core/controllers/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def _get_exploration_player_data(
}


class ExplorationPageEmbed(base.BaseHandler):
class ExplorationEmbedPage(base.BaseHandler):
"""Page describing a single embedded exploration."""

@acl_decorators.can_play_exploration
Expand Down
1 change: 1 addition & 0 deletions core/controllers/suggestion.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from core.domain import acl_decorators
from core.domain import suggestion_services
from core.platform import models
import feconf

(suggestion_models,) = models.Registry.import_models([models.NAMES.suggestion])

Expand Down
1 change: 1 addition & 0 deletions core/controllers/topic_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from core.domain import acl_decorators
from core.domain import story_services
from core.domain import topic_services
import feconf


class TopicViewerPage(base.BaseHandler):
Expand Down
23 changes: 11 additions & 12 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def ui_access_wrapper(self, *args, **kwargs):
get_redirect_route(r'%s' % feconf.ADMIN_URL, admin.AdminPage),
get_redirect_route(r'/adminhandler', admin.AdminHandler),
get_redirect_route(r'/adminrolehandler', admin.AdminRoleHandler),
get_redirect_route(r'/adminjoboutput', admin.AdminJobOutput),
get_redirect_route(r'/adminjoboutput', admin.AdminJobOutputHandler),
get_redirect_route(
r'/admintopicscsvdownloadhandler',
admin.AdminTopicsCsvFileDownloader),
Expand Down Expand Up @@ -241,7 +241,7 @@ def ui_access_wrapper(self, *args, **kwargs):
topics_and_skills_dashboard.NewTopicHandler),
get_redirect_route(
r'%s' % feconf.UPLOAD_EXPLORATION_URL,
creator_dashboard.UploadExploration),
creator_dashboard.UploadExplorationHandler),
get_redirect_route(
r'%s' % feconf.LEARNER_DASHBOARD_URL,
learner_dashboard.LearnerDashboardPage),
Expand Down Expand Up @@ -285,25 +285,25 @@ def ui_access_wrapper(self, *args, **kwargs):
resources.ValueGeneratorHandler),
get_redirect_route(
r'%s' % feconf.FRACTIONS_LANDING_PAGE_URL,
custom_landing_pages.FractionLandingPageHandler),
custom_landing_pages.FractionLandingPage),
get_redirect_route(
r'%s' % feconf.LIBRARY_INDEX_URL,
library.LibraryPageHandler),
library.LibraryPage),
get_redirect_route(
r'%s' % feconf.LIBRARY_INDEX_DATA_URL,
library.LibraryIndexHandler),
get_redirect_route(
r'%s' % feconf.LIBRARY_RECENTLY_PUBLISHED_URL,
library.LibraryGroupPageHandler),
library.LibraryGroupPage),
get_redirect_route(
r'%s' % feconf.LIBRARY_TOP_RATED_URL,
library.LibraryGroupPageHandler),
library.LibraryGroupPage),
get_redirect_route(
r'%s' % feconf.LIBRARY_GROUP_DATA_URL,
library.LibraryGroupIndexHandler),
get_redirect_route(
r'%s' % feconf.LIBRARY_SEARCH_URL,
library.LibraryPageHandler),
library.LibraryPage),
get_redirect_route(
r'%s' % feconf.LIBRARY_SEARCH_DATA_URL, library.SearchHandler),
get_redirect_route(r'/gallery', library.LibraryRedirectPage),
Expand Down Expand Up @@ -347,7 +347,7 @@ def ui_access_wrapper(self, *args, **kwargs):
reader.ExplorationPage),
get_redirect_route(
r'%s/<exploration_id>' % feconf.EXPLORATION_URL_EMBED_PREFIX,
reader.ExplorationPageEmbed),
reader.ExplorationEmbedPage),
get_redirect_route(
r'%s/<exploration_id>' % feconf.EXPLORATION_INIT_URL_PREFIX,
reader.ExplorationHandler),
Expand Down Expand Up @@ -479,7 +479,7 @@ def ui_access_wrapper(self, *args, **kwargs):
feedback.ThreadListHandler),
get_redirect_route(
r'%s/<topic_id>' % feconf.FEEDBACK_THREADLIST_URL_PREFIX_FOR_TOPICS,
feedback.ThreadListHandlerForTopics),
feedback.ThreadListHandlerForTopicsHandler),
get_redirect_route(
r'%s/<thread_id>' % feconf.FEEDBACK_THREAD_URL_PREFIX,
feedback.ThreadHandler),
Expand Down Expand Up @@ -586,7 +586,7 @@ def ui_access_wrapper(self, *args, **kwargs):
r'/emaildashboarddatahandler',
email_dashboard.EmailDashboardDataHandler),
get_redirect_route(
r'/querystatuscheck', email_dashboard.QueryStatusCheck),
r'/querystatuscheck', email_dashboard.QueryStatusCheckHandler),
get_redirect_route(
r'/emaildashboardresult/<query_id>',
email_dashboard.EmailDashboardResultPage),
Expand Down Expand Up @@ -638,8 +638,7 @@ def ui_access_wrapper(self, *args, **kwargs):
get_redirect_route(
r'/admintopicscsvdownloadhandler',
admin.AdminTopicsCsvFileDownloader),
get_redirect_route(
r'/<:.*>', pages.MaintenancePage)]
get_redirect_route(r'/<:.*>', pages.MaintenancePage)]
else:
URLS_TO_SERVE = URLS

Expand Down