Skip to content

Commit bb9bd8d

Browse files
committed
Added a patch for tastypie under django 2.2, to catch field error exceptions that were handled differently under earlier django versions.
- Legacy-Id: 18407
1 parent 8d2e0a0 commit bb9bd8d

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

ietf/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,6 +1137,7 @@ def skip_unreadable_post(record):
11371137
'patch/fix-django-password-strength-kwargs.patch',
11381138
'patch/add-django-http-cookie-value-none.patch',
11391139
'patch/django-cookie-delete-with-all-settings.patch',
1140+
'patch/tastypie-django22-fielderror-response.patch',
11401141
]
11411142
if DEBUG:
11421143
try:
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--- tastypie/resources.py.orig 2020-08-24 13:14:25.463166100 +0200
2+
+++ tastypie/resources.py 2020-08-24 13:15:55.133759224 +0200
3+
@@ -15,7 +15,7 @@
4+
ObjectDoesNotExist, MultipleObjectsReturned, ValidationError, FieldDoesNotExist
5+
)
6+
from django.core.signals import got_request_exception
7+
-from django.core.exceptions import ImproperlyConfigured
8+
+from django.core.exceptions import ImproperlyConfigured, FieldError
9+
from django.db.models.fields.related import ForeignKey
10+
try:
11+
from django.contrib.gis.db.models.fields import GeometryField
12+
@@ -2207,6 +2207,8 @@
13+
return self.authorized_read_list(objects, bundle)
14+
except ValueError:
15+
raise BadRequest("Invalid resource lookup data provided (mismatched type).")
16+
+ except FieldError as e:
17+
+ raise BadRequest("Invalid resource lookup: %s." % e)
18+
19+
def obj_get(self, bundle, **kwargs):
20+
"""

0 commit comments

Comments
 (0)