Skip to content

Refactor student views - #2526

Merged
singingwolfboy merged 1 commit into
masterfrom
db/refactor-student-view
Feb 10, 2014
Merged

Refactor student views#2526
singingwolfboy merged 1 commit into
masterfrom
db/refactor-student-view

Conversation

@singingwolfboy

Copy link
Copy Markdown
Contributor

Fix pylint/pep8 warnings, use JsonResponse instead of HttpResponse where useful, put in TODOs to change HTTP status codes to be more accurate, update tests to be less brittle.

Comment thread common/djangoapps/student/views.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reasoning behind adding a TODO here instead of just making the jsonresponse actually return the status code as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because that's changing functionality. This pull request is intended to be purely for cleanup, without changing functionality whatsoever.

@sarina

sarina commented Feb 10, 2014

Copy link
Copy Markdown
Contributor

while you're at it I'd fix a few more:

$ pep8 common/djangoapps/student/tests/test_login.py
common/djangoapps/student/tests/test_login.py:26:1: E302 expected 2 blank lines, found 1

and there's a handful of pep8/pylint in tests.py that look straightforward to fix.

The fixes and refactoring looks good overall but I am curious about the TODOs as mentioned above.

@cpennington

Copy link
Copy Markdown
Contributor

👍

Comment thread common/djangoapps/student/views.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to disable fixme warnings for the entire file—is this actually what we want? I'd kind of prefer disabling it on a case-by-case basis (even though it's kind of annoying to add it next to each line), since I think we'd like to prevent people from adding TODOs to this file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that # pylint: disable= disables a warning for the entire file, regardless of where you put it. So repeating it multiple times, one on every line that I added, is more annoying and still ends up silencing all the TODOs anyway. Or am I wrong about that?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah - you put the pragma after a line to just disable it on that one line. See https://github.com/edx/edx-platform/blob/master/CONTRIBUTING.rst#pythonjavascript-styling

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although it's preferable to say disable=unused-argument over disable=W0511 as the latter obfuscates what warning you're actually disabling.

@sarina

sarina commented Feb 10, 2014

Copy link
Copy Markdown
Contributor

🚢 (once tests pass obvs)

@flowerhack

Copy link
Copy Markdown
Contributor

besides that one suggestion, ⛵

Fix pylint/pep8 warnings, use JsonResponse instead of HttpResponse where useful,
put in TODOs to change HTTP status codes to be more accurate.
@sarina

sarina commented Feb 10, 2014

Copy link
Copy Markdown
Contributor

👍 let's merge this!

singingwolfboy added a commit that referenced this pull request Feb 10, 2014
@singingwolfboy
singingwolfboy merged commit 3938e84 into master Feb 10, 2014
@singingwolfboy
singingwolfboy deleted the db/refactor-student-view branch February 10, 2014 20:22
alexjmpb pushed a commit to Pearson-Advance/edx-platform that referenced this pull request May 9, 2024
…edx#2526)

Co-authored-by: Sagirov Eugeniy <evhenyj.sahyrov@raccoongang.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants