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

AttributeError at /api/v0/courses/111/responses/ #412

Closed
redilonka opened this issue Mar 28, 2017 · 2 comments
Closed

AttributeError at /api/v0/courses/111/responses/ #412

redilonka opened this issue Mar 28, 2017 · 2 comments

Comments

@redilonka
Copy link
Collaborator

redilonka commented Mar 28, 2017

Exception when trying to get responses from non existent Course.

Also error has this bug: /api/v0/courses/111/errors/

Traceback:
File "/home/wwwapps/_ve_socraticqs2/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  132.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/wwwapps/_ve_socraticqs2/local/lib/python2.7/site-packages/django/views/decorators/csrf.py" in wrapped_view
  58.         return view_func(*args, **kwargs)
File "/home/wwwapps/_ve_socraticqs2/local/lib/python2.7/site-packages/rest_framework/viewsets.py" in view
  83.             return self.dispatch(request, *args, **kwargs)
File "/home/wwwapps/_ve_socraticqs2/local/lib/python2.7/site-packages/rest_framework/views.py" in dispatch
  477.             response = self.handle_exception(exc)
File "/home/wwwapps/_ve_socraticqs2/local/lib/python2.7/site-packages/rest_framework/views.py" in handle_exception
  437.             self.raise_uncaught_exception(exc)
File "/home/wwwapps/_ve_socraticqs2/local/lib/python2.7/site-packages/rest_framework/views.py" in dispatch
  474.             response = handler(request, *args, **kwargs)
File "/home/wwwapps/_ve_socraticqs2/local/lib/python2.7/site-packages/rest_framework/mixins.py" in list
  40.         queryset = self.filter_queryset(self.get_queryset())
File "/home/wwwapps/socraticqs2/mysite/api/v0/views.py" in get_queryset
  20.             self.request, Course.objects.filter(id=self.kwargs.get('course_id')).first()
File "/home/wwwapps/_ve_socraticqs2/local/lib/python2.7/site-packages/rest_framework/views.py" in check_object_permissions
  332.             if not permission.has_object_permission(request, self, obj):
File "/home/wwwapps/socraticqs2/mysite/api/permissions.py" in has_object_permission
  9.         return obj.addedBy == request.user

Exception Type: AttributeError at /api/v0/courses/111/responses/
Exception Value: 'NoneType' object has no attribute 'addedBy'

ER: i'll see error, not exception

alexbojko added a commit to raccoongang/socraticqs2 that referenced this issue Mar 29, 2017
…courses/111/responses/ and /api/v0/courses/111/errors/

Added get_object_or_404 from rest_framework.generics
cmltaWt0 added a commit that referenced this issue Mar 29, 2017
fix(issue#412): Fixes issue #412 - AttributeError at /api/v0/courses/111/responses/ and /api/v0/courses/111/errors/
@cmltaWt0 cmltaWt0 assigned DenisKolesnik and unassigned alexbojko Mar 29, 2017
@cmltaWt0 cmltaWt0 added this to the Named release Hedgehog milestone Mar 29, 2017
@cmltaWt0
Copy link
Collaborator

DOD:

HTTP 404 Not Found
Allow: GET, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "detail": "Not found."
}

@DenisKolesnik
Copy link
Collaborator

AR:

HTTP 404 Not Found
Allow: GET, OPTIONS
Content-Type: application/json
Vary: Accept

{
"detail": "Not found."
}

Bug has been fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants