0002-return-explicite-errors-14967.patch
mandayejs/views.py | ||
---|---|---|
20 | 20 |
import requests |
21 | 21 | |
22 | 22 |
from django.contrib.auth.models import User |
23 |
from django.shortcuts import get_object_or_404 |
|
24 | ||
25 | 23 |
from rest_framework import status |
26 | 24 |
from rest_framework.views import APIView |
27 | 25 |
from rest_framework.response import Response |
... | ... | |
41 | 39 |
app_settings.SITE_WS_ENDPOINT['account_details']) |
42 | 40 | |
43 | 41 |
username = kwargs['username'] |
44 |
user = get_object_or_404(User, username=username) |
|
45 |
credentials = get_object_or_404(UserCredentials, user=user) |
|
42 |
# user = get_object_or_404(User, username=username) |
|
43 |
try: |
|
44 |
user = User.objects.get(username=username) |
|
45 |
except (User.DoesNotExist,): |
|
46 |
return Response('User %s does not exist' % username, status=status.HTTP_404_NOT_FOUND) |
|
47 |
# credentials = get_object_or_404(UserCredentials, user=user) |
|
48 |
try: |
|
49 |
credentials = UserCredentials.objects.get(user=user) |
|
50 |
except (UserCredentials.DoesNotExist,): |
|
51 |
return Response('User %s is not associated' % username, status=status.HTTP_404_NOT_FOUND) |
|
46 | 52 | |
47 | 53 |
login_url = request.build_absolute_uri( |
48 | 54 |
'/DEFAULT/Ermes/Recherche/logon.svc/logon') |
49 |
- |