forked from ietf-tools/datatracker
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtastypie-django22-fielderror-response.patch
More file actions
32 lines (29 loc) · 1.34 KB
/
tastypie-django22-fielderror-response.patch
File metadata and controls
32 lines (29 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
--- tastypie/resources.py.orig 2020-08-24 13:14:25.463166100 +0200
+++ tastypie/resources.py 2020-08-24 13:15:55.133759224 +0200
@@ -15,7 +15,7 @@
ObjectDoesNotExist, MultipleObjectsReturned, ValidationError, FieldDoesNotExist
)
from django.core.signals import got_request_exception
-from django.core.exceptions import ImproperlyConfigured
+from django.core.exceptions import ImproperlyConfigured, FieldError
from django.db.models.fields.related import ForeignKey
try:
from django.contrib.gis.db.models.fields import GeometryField
@@ -2207,6 +2207,8 @@
return self.authorized_read_list(objects, bundle)
except ValueError:
raise BadRequest("Invalid resource lookup data provided (mismatched type).")
+ except FieldError as e:
+ raise BadRequest("Invalid resource lookup: %s." % e)
def obj_get(self, bundle, **kwargs):
"""
--- tastypie/paginator.py.orig 2020-08-25 15:24:46.391588425 +0200
+++ tastypie/paginator.py 2020-08-25 15:24:53.591797122 +0200
@@ -128,6 +128,8 @@
except (AttributeError, TypeError):
# If it's not a QuerySet (or it's ilk), fallback to ``len``.
return len(self.objects)
+ except ValueError as e:
+ raise BadRequest("Invalid resource lookup: %s." % e)
def get_previous(self, limit, offset):
"""