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

RESTful refactoring of /course access continued #1542

Merged
merged 1 commit into from
Oct 30, 2013
Merged

Conversation

dmitchell
Copy link
Contributor

Move index access into the url
Move course creation into the url
Add helper methods for testing to serialize json data and set accept header.

@cahrens this is part of my story but seemed big enuf to do as a PR, plz revie
@singingwolfboy plz review

else:
return HttpResponseNotFound()


@login_required
@ensure_csrf_cookie
def course_listing(request):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved this here and renamed from user.index()

Move index access into the url
Move course creation into the url
Add helper methods for testing to serialize json data and set accept header.
else:
course_creator_status = 'granted'

return course_creator_status
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be clearer to return early, rather than set a variable and return it at the end of the function.

Copy link

Choose a reason for hiding this comment

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

I personally prefer single points of return (generally advised in "clean code"). And I wrote that code. :)

@dmitchell
Copy link
Contributor Author

@singingwolfboy @cahrens May I merge this? (the test failure is a false alarm on quality)

@cahrens
Copy link

cahrens commented Oct 30, 2013

👍

@@ -46,6 +45,6 @@ def login_page(request):
def howitworks(request):
"Proxy view"
if request.user.is_authenticated():
return index(request)
return redirect('/course')
Copy link
Contributor

Choose a reason for hiding this comment

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

This should use Django's reverse function, rather than hard-coding the URL

@singingwolfboy
Copy link
Contributor

😩 👍 😩

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.

3 participants