forked from ietf-tools/datatracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtastypie-django22-fielderror-response.patch
More file actions
32 lines (29 loc) · 1.35 KB
/
tastypie-django22-fielderror-response.patch
File metadata and controls
32 lines (29 loc) · 1.35 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 2025-07-29 19:00:01.526948002 +0000
+++ tastypie/resources.py 2025-07-29 19:07:15.324127008 +0000
@@ -12,7 +12,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
from django.urls.conf import re_path
from tastypie.utils.timezone import make_naive_utc
@@ -2216,6 +2216,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
@@ -124,6 +124,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):
"""