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
Made lint changes
  • Loading branch information
Rishav Chakraborty committed Nov 27, 2018
commit 0f7b1ff2c1c5f1bd17da52b2a82445e818351c35
7 changes: 4 additions & 3 deletions core/controllers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,16 +419,17 @@ def _render_exception_json_or_html(self, return_type, values):

method = self.request.environ['REQUEST_METHOD']

if(return_type == feconf.HANDLER_TYPE_HTML and
method == 'GET'):
if return_type == feconf.HANDLER_TYPE_HTML and (
method == 'GET'):
self.values.update(values)
if 'iframed' in self.values and self.values['iframed']:
self.render_template(
'pages/error/error_iframed.html', iframe_restriction=None)
else:
self.render_template('pages/error/error.html')
else:
if return_type != feconf.HANDLER_TYPE_JSON:
if return_type != feconf.HANDLER_TYPE_JSON and (
return_type != feconf.HANDLER_TYPE_DOWNLOADABLE):
logging.warning('Not a recognized return type: '
'defaulting to render JSON.')
self.render_json(values)
Expand Down
3 changes: 1 addition & 2 deletions core/controllers/base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,7 @@ def get(self):
"""Handles GET requests."""
file_contents = 'example'
self.render_downloadable_file(
file_contents, 'example.pdf',
'text/plain')
file_contents, 'example.pdf', 'text/plain')

def setUp(self):
super(RenderDownloadableTest, self).setUp()
Expand Down