Revision f5ff1d1e snf-pithos-app/pithos/api/util.py
b/snf-pithos-app/pithos/api/util.py | ||
---|---|---|
1134 | 1134 |
request.META['HTTP_X_AUTH_TOKEN'] = token |
1135 | 1135 |
# Get the response object |
1136 | 1136 |
response = func(request, *args, **kwargs) |
1137 |
if response.status_code in [200, 206, 304, 412, 416]: |
|
1138 |
return response |
|
1139 |
elif response.status_code == 404: |
|
1137 |
if response.status_code == 404: |
|
1140 | 1138 |
raise Http404() |
1141 | 1139 |
elif response.status_code in [401, 403]: |
1142 | 1140 |
return HttpResponseForbidden() |
1143 |
else: |
|
1144 |
# unexpected response status |
|
1145 |
raise Exception(response.status_code) |
|
1141 |
return response |
|
1146 | 1142 |
return wrapper |
1147 | 1143 |
return decorator |
1148 | 1144 |
|
Also available in: Unified diff