unable to except ValueError thrown by mongoengine - django

I'm trying to catch a ValueError that occurs due to the skip parameter equal to a negative number. For example,
try:
MyModel.objects.skip(-1)
except ValueError as error:
print(error)
does not do anything. It doesn't error out with ANY message nor does it do anything else. What I want is just to catch the ValueError and handle it appropriately.
If I except TypeError (that is not raised) instead of ValueError it displays the same behaviour.
The traceback:
Traceback (most recent call last):
File "/home/admin/.local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 35, in inner
response = get_response(request)
File "/home/admin/.local/lib/python3.6/site-packages/django/core/handlers/base.py", line 128, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/home/admin/.local/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/admin/.local/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/rest_framework/viewsets.py", line 103, in view
return self.dispatch(request, *args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/rest_framework/views.py", line 483, in dispatch
response = self.handle_exception(exc)
File "/usr/local/lib/python3.6/dist-packages/rest_framework/views.py", line 443, in handle_exception
self.raise_uncaught_exception(exc)
File "/usr/local/lib/python3.6/dist-packages/rest_framework/views.py", line 480, in dispatch
response = handler(request, *args, **kwargs)
File "/home/admin/test_serverside/essences/test_result/views.py", line 273, in get_history
self._format_response_json(serializer.data),
File "/usr/local/lib/python3.6/dist-packages/rest_framework/serializers.py", line 765, in data
ret = super(ListSerializer, self).data
File "/usr/local/lib/python3.6/dist-packages/rest_framework/serializers.py", line 266, in data
self._data = self.get_initial()
File "/usr/local/lib/python3.6/dist-packages/rest_framework/serializers.py", line 600, in get_initial
return self.to_representation(self.initial_data)
File "/usr/local/lib/python3.6/dist-packages/rest_framework/serializers.py", line 683, in to_representation
self.child.to_representation(item) for item in iterable
File "/usr/local/lib/python3.6/dist-packages/rest_framework/serializers.py", line 683, in <listcomp>
self.child.to_representation(item) for item in iterable
File "/usr/local/lib/python3.6/dist-packages/mongoengine/queryset/queryset.py", line 99, in _iter_results
self._populate_cache()
File "/usr/local/lib/python3.6/dist-packages/mongoengine/queryset/queryset.py", line 118, in _populate_cache
self._result_cache.append(next(self))
File "/usr/local/lib/python3.6/dist-packages/mongoengine/queryset/base.py", line 1466, in __next__
raw_doc = next(self._cursor)
File "/usr/local/lib/python3.6/dist-packages/mongoengine/queryset/base.py", line 1573, in _cursor
self._cursor_obj.skip(self._skip)
File "/usr/local/lib/python3.6/dist-packages/pymongo/cursor.py", line 491, in skip
raise ValueError("skip must be >= 0")
ValueError: skip must be >= 0

Related

AttributeError: 'Overview' object has no attribute '__qualname__'

I am updating Django from 1.11.27 to 2.2.9 - python2.7 to python3.7 - made all the changes, but when I start server I have this error.
AttributeError: 'Overview' object has no attribute '__qualname__'
Traceback (most recent call last):
File "/Users/user/Sites/project-folder/venv/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/Users/user/Sites/project-folder/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/Users/user/Sites/project-folder/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/contextlib.py", line 74, in inner
return func(*args, **kwds)
File "/Users/user/Sites/project-folder/venv/lib/python3.7/site-packages/django/contrib/admin/sites.py", line 241, in wrapper
return self.admin_view(view, cacheable)(*args, **kwargs)
File "/Users/user/Sites/project-folder/venv/lib/python3.7/site-packages/django/utils/decorators.py", line 142, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/Users/user/Sites/project-folder/venv/lib/python3.7/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File "/Users/user/Sites/project-folder/venv/lib/python3.7/site-packages/django/contrib/admin/sites.py", line 213, in inner
if request.path == reverse('admin:logout', current_app=self.name):
File "/Users/user/Sites/project-folder/venv/lib/python3.7/site-packages/django/urls/base.py", line 58, in reverse
app_list = resolver.app_dict[ns]
File "/Users/user/Sites/project-folder/venv/lib/python3.7/site-packages/django/urls/resolvers.py", line 513, in app_dict
self._populate()
File "/Users/user/Sites/project-folder/venv/lib/python3.7/site-packages/django/urls/resolvers.py", line 464, in _populate
url_pattern._populate()
File "/Users/user/Sites/project-folder/venv/lib/python3.7/site-packages/django/urls/resolvers.py", line 464, in _populate
url_pattern._populate()
File "/Users/user/Sites/project-folder/venv/lib/python3.7/site-packages/django/urls/resolvers.py", line 452, in _populate
self._callback_strs.add(url_pattern.lookup_str)
File "/Users/user/Sites/project-folder/venv/lib/python3.7/site-packages/django/utils/functional.py", line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Users/user/Sites/project-folder/venv/lib/python3.7/site-packages/django/urls/resolvers.py", line 362, in lookup_str
return callback.__module__ + "." + callback.__qualname__
AttributeError: 'Overview' object has no attribute '__qualname__'
Found the exception here (Django 2.2.9):
https://github.com/django/django/blob/master/django/urls/resolvers.py#L361
#cached_property
def lookup_str(self):
"""
A string that identifies the view (e.g. 'path.to.view_function' or
'path.to.ClassBasedView').
"""
callback = self.callback
if isinstance(callback, functools.partial):
callback = callback.func
if not hasattr(callback, '__name__'):
return callback.__module__ + "." + callback.__class__.__name__
return callback.__module__ + "." + callback.__qualname__

Unicode Exception thrown when other Exception occurs

I have this strange behavior in my django project (1.11) running (example from the dev server): first I get a logging error, which might have to do with the setup
However, the real strange thing is: whenever an exception is thrown, this causes a Unicode error. I am assuming there might be a problem with the language setup or python version interference?
This is the view - I added the zero division to cause the error. When I remove it, everything works fine:
class TestView(TemplateView):
template_name = "table.html"
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
dummy=1/0
return context
Here the error log:
--- Logging error ---
Traceback (most recent call last):
File "/home/franzritt/.virtualenvs/sky/lib/python3.4/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/home/franzritt/.virtualenvs/sky/lib/python3.4/site-packages/django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/home/franzritt/.virtualenvs/sky/lib/python3.4/site-packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/franzritt/.virtualenvs/sky/lib/python3.4/site-packages/django/views/generic/base.py", line 68, in view
return self.dispatch(request, *args, **kwargs)
File "/home/franzritt/.virtualenvs/sky/lib/python3.4/site-packages/django/views/generic/base.py", line 88, in dispatch
return handler(request, *args, **kwargs)
File "/home/franzritt/.virtualenvs/sky/lib/python3.4/site-packages/django/views/generic/base.py", line 155, in get
context = self.get_context_data(**kwargs)
Traceback (most recent call last):
File "/home/franzritt/.virtualenvs/sky/lib/python3.4/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/home/franzritt/.virtualenvs/sky/lib/python3.4/site-packages/django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/home/franzritt/.virtualenvs/sky/lib/python3.4/site-packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/franzritt/.virtualenvs/sky/lib/python3.4/site-packages/django/views/generic/base.py", line 68, in view
return self.dispatch(request, *args, **kwargs)
File "/home/franzritt/.virtualenvs/sky/lib/python3.4/site-packages/django/views/generic/base.py", line 88, in dispatch
return handler(request, *args, **kwargs)
File "/home/franzritt/.virtualenvs/sky/lib/python3.4/site-packages/django/views/generic/base.py", line 155, in get
context = self.get_context_data(**kwargs)
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 49868)
Traceback (most recent call last):
File "/home/franzritt/.virtualenvs/sky/lib/python3.4/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/home/franzritt/.virtualenvs/sky/lib/python3.4/site-packages/django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/home/franzritt/.virtualenvs/sky/lib/python3.4/site-packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/franzritt/.virtualenvs/sky/lib/python3.4/site-packages/django/views/generic/base.py", line 68, in view
return self.dispatch(request, *args, **kwargs)
File "/home/franzritt/.virtualenvs/sky/lib/python3.4/site-packages/django/views/generic/base.py", line 88, in dispatch
return handler(request, *args, **kwargs)
File "/home/franzritt/.virtualenvs/sky/lib/python3.4/site-packages/django/views/generic/base.py", line 155, in get
context = self.get_context_data(**kwargs)
Unhandled exception in thread started by <bound method Thread._bootstrap of <Thread(Thread-1, started daemon -173327552)>>
Traceback (most recent call last):
File "/home/franzritt/.virtualenvs/sky/lib/python3.4/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/home/franzritt/.virtualenvs/sky/lib/python3.4/site-packages/django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/home/franzritt/.virtualenvs/sky/lib/python3.4/site-packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/franzritt/.virtualenvs/sky/lib/python3.4/site-packages/django/views/generic/base.py", line 68, in view
return self.dispatch(request, *args, **kwargs)
File "/home/franzritt/.virtualenvs/sky/lib/python3.4/site-packages/django/views/generic/base.py", line 88, in dispatch
return handler(request, *args, **kwargs)
File "/home/franzritt/.virtualenvs/sky/lib/python3.4/site-packages/django/views/generic/base.py", line 155, in get
context = self.get_context_data(**kwargs)
File "/home/franzritt/sky/monitoring/views.py", line 19, in get_context_data
ZeroDivisionError: division by zero
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.4/logging/__init__.py", line 978, in emit
msg = self.format(record)
File "/usr/lib/python3.4/logging/__init__.py", line 828, in format
return fmt.format(record)
File "/usr/lib/python3.4/logging/__init__.py", line 573, in format
record.exc_text = self.formatException(record.exc_info)
File "/usr/lib/python3.4/logging/__init__.py", line 523, in formatException
traceback.print_exception(ei[0], ei[1], tb, None, sio)
File "/usr/lib/python3.4/traceback.py", line 169, in print_exception
for line in _format_exception_iter(etype, value, tb, limit, chain):
File "/usr/lib/python3.4/traceback.py", line 153, in _format_exception_iter
yield from _format_list_iter(_extract_tb_iter(tb, limit=limit))
File "/usr/lib/python3.4/traceback.py", line 18, in _format_list_iter
for filename, lineno, name, line in extracted_list:
File "/usr/lib/python3.4/traceback.py", line 65, in _extract_tb_or_stack_iter
line = linecache.getline(filename, lineno, f.f_globals)
File "/home/franzritt/.virtualenvs/sky/lib/python3.4/linecache.py", line 15, in getline
lines = getlines(filename, module_globals)
File "/home/franzritt/.virtualenvs/sky/lib/python3.4/linecache.py", line 41, in getlines
return updatecache(filename, module_globals)
File "/home/franzritt/.virtualenvs/sky/lib/python3.4/linecache.py", line 127, in updatecache
lines = fp.readlines()
File "/home/franzritt/.virtualenvs/sky/lib/python3.4/codecs.py", line 313, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe4 in position 957: invalid continuation byte
I have shown here the - as I think - important parts of the error log. The logging error and the unicode error show up many more times. So my basic problem is, whenever I get an exepction I get 20 Unicode expections and 10 logging errors, which makes it difficult to find the real exception.
Your model str is not handling Unicode correctly. I recommend you put the UTF-8 encoding. To do this, put this at the beginning of you .py module/file:
# -*- coding: utf-8 -*-
If that does not work, try with:
def __str__(self):
return self.name.encode('utf8')
Or with:
class TestView(TemplateView):
template_name = "table.html"
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
dummy=1/0
return context.encode('utf-8')

What is '_get_val_from_obj' mechanic does?

I am new to tooling job. Currently my favorite package in Django is outdated and seems no one care by now. Therefore I would like to study it.
Problem:
https://github.com/philippbosch/django-geoposition/issues/100
Traceback (most recent call last):
File "/Users/sarit/.pyenv/versions/3.6.4/envs/poink/lib/python3.6/site-packages/django/core/handlers/exception.py", line 35, in inner
response = get_response(request)
File "/Users/sarit/.pyenv/versions/3.6.4/envs/poink/lib/python3.6/site-packages/django/core/handlers/base.py", line 128, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/Users/sarit/.pyenv/versions/3.6.4/envs/poink/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/sarit/.pyenv/versions/3.6.4/lib/python3.6/contextlib.py", line 52, in inner
return func(*args, **kwds)
File "/Users/sarit/.pyenv/versions/3.6.4/envs/poink/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "/Users/sarit/.pyenv/versions/3.6.4/envs/poink/lib/python3.6/site-packages/rest_framework/viewsets.py", line 95, in view
return self.dispatch(request, *args, **kwargs)
File "/Users/sarit/.pyenv/versions/3.6.4/envs/poink/lib/python3.6/site-packages/rest_framework/views.py", line 494, in dispatch
response = self.handle_exception(exc)
File "/Users/sarit/.pyenv/versions/3.6.4/envs/poink/lib/python3.6/site-packages/rest_framework/views.py", line 454, in handle_exception
self.raise_uncaught_exception(exc)
File "/Users/sarit/.pyenv/versions/3.6.4/envs/poink/lib/python3.6/site-packages/rest_framework/views.py", line 491, in dispatch
response = handler(request, *args, **kwargs)
File "/Users/sarit/.pyenv/versions/3.6.4/envs/poink/lib/python3.6/site-packages/rest_framework/mixins.py", line 22, in create
headers = self.get_success_headers(serializer.data)
File "/Users/sarit/.pyenv/versions/3.6.4/envs/poink/lib/python3.6/site-packages/rest_framework/serializers.py", line 537, in data
ret = super(Serializer, self).data
File "/Users/sarit/.pyenv/versions/3.6.4/envs/poink/lib/python3.6/site-packages/rest_framework/serializers.py", line 262, in data
self._data = self.to_representation(self.instance)
File "/Users/sarit/.pyenv/versions/3.6.4/envs/poink/lib/python3.6/site-packages/rest_framework/serializers.py", line 504, in to_representation
ret[field.field_name] = field.to_representation(attribute)
File "/Users/sarit/.pyenv/versions/3.6.4/envs/poink/lib/python3.6/site-packages/rest_framework/fields.py", line 1858, in to_representation
return self.model_field.value_to_string(obj)
File "/Users/sarit/.pyenv/versions/3.6.4/envs/poink/src/django-geoposition/geoposition/fields.py", line 50, in value_to_string
value = self._get_val_from_obj(obj)
AttributeError: 'GeopositionField' object has no attribute '_get_val_from_obj'
Official Docs:
https://docs.djangoproject.com/en/2.0/releases/2.0/
Field._get_val_from_obj() is removed.
Question:
How to solve this error?
def value_to_string(self, obj):
value = self._get_val_from_obj(obj)
return smart_text(value)
Update:
https://github.com/pennersr/django-allauth/issues/1865
#linaskilius says
Django recommends using the Field.value_from_object() instead.
My Fork:
https://github.com/elcolie/django-geoposition

IndexError: list index out of range in Test case

I have strange problems
I have next code Using TesCase and APIClient to get request with token
class Profile(TestCase):
fixtures = ['profiles.json']
def setUp(self):
self.client = APIClient()
self.user = Profile.objects.get(username='some-username')
self.token = Token.objects.create(user=self.user)
self.client.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key)
def test_profile(self):
response = self.client.get('/api/some-username/profile/')
print(response.status_code)
print(response.data)`
Authorization goes well,but the I received error. If i use requests.get with headers (token) to development django server all pass well i receive a correct json response
Full Traceback when i run this test:
Traceback (most recent call last):
File "/home/work/project/profiles/tests.py", line 103, in test_user_profile
response = self.client.get('/api/some-username/profile/')
File "/usr/local/lib/python3.5/dist-packages/rest_framework/test.py", line 291, in get
response = super(APIClient, self).get(path, data=data, **extra)
File "/usr/local/lib/python3.5/dist-packages/rest_framework/test.py", line 208, in get
return self.generic('GET', path, **r)
File "/usr/local/lib/python3.5/dist-packages/rest_framework/test.py", line 237, in generic
method, path, data, content_type, secure, **extra)
File "/usr/local/lib/python3.5/dist-packages/django/test/client.py", line 416, in generic
return self.request(**r)
File "/usr/local/lib/python3.5/dist-packages/rest_framework/test.py", line 288, in request
return super(APIClient, self).request(**kwargs)
File "/usr/local/lib/python3.5/dist-packages/rest_framework/test.py", line 240, in request
request = super(APIRequestFactory, self).request(**kwargs)
File "/usr/local/lib/python3.5/dist-packages/django/test/client.py", line 501, in request
six.reraise(*exc_info)
File "/usr/local/lib/python3.5/dist-packages/django/utils/six.py", line 686, in reraise
raise value
File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python3.5/dist-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
return view_func(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/django/views/generic/base.py", line 68, in view
return self.dispatch(request, *args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/rest_framework/views.py", line 489, in dispatch
response = self.handle_exception(exc)
File "/usr/local/lib/python3.5/dist-packages/rest_framework_tracking/mixins.py", line 69, in handle_exception
response = super(BaseLoggingMixin, self).handle_exception(exc)
File "/usr/local/lib/python3.5/dist-packages/rest_framework/views.py", line 449, in handle_exception
self.raise_uncaught_exception(exc)
File "/usr/local/lib/python3.5/dist-packages/rest_framework/views.py", line 486, in dispatch
response = handler(request, *args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/rest_framework/generics.py", line 254, in get
return self.retrieve(request, *args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/rest_framework/mixins.py", line 58, in retrieve
return Response(serializer.data)
File "/usr/local/lib/python3.5/dist-packages/rest_framework/serializers.py", line 533, in data
ret = super(Serializer, self).data
File "/usr/local/lib/python3.5/dist-packages/rest_framework/serializers.py", line 262, in data
self._data = self.to_representation(self.instance)
File "/usr/local/lib/python3.5/dist-packages/rest_framework/serializers.py", line 500, in to_representation
ret[field.field_name] = field.to_representation(attribute)
File "/home/work/project/profiles/serializers.py", line 10, in to_representation
return institute.all()[0].slug
File "/usr/local/lib/python3.5/dist-packages/django/db/models/query.py", line 289, in __getitem__
return list(qs)[0]
IndexError: list index out of range
How know what is the problem?

build_filters() got an unexpected keyword argument 'ignore_bad_filters'

I just updated my code from django 1.8 to 1.11 and so i also had to update tasty pie. Before update everything worked fine but now I am getting this error on one of my tests.
Here is the test case
def test_does_not_return_restricted_fields_when_insufficient_permissions(self):
self.user.user_permissions.all().delete()
response = self.api_client.get(url,
format='json',
authentication=self.create_apikey(username=self.username, api_key=self.api_key),
data=data)
Here is the full Trace,
Traceback (most recent call last):
File "/spare/local/projects/towerportal/apps/exchangedb/tests/test_api.py", line 68, in test_does_not_return_restricted_fields_when_insufficient_permissions
response = self.get_response(self.detail_url)
File "/spare/local/projects/towerportal/apps/exchangedb/tests/test_api.py", line 26, in get_response
data=data)
File "/spare/local/venv/lib/python2.7/site-packages/tastypie/test.py", line 70, in get
return self.client.get(uri, **kwargs)
File "/spare/local/venv/lib/python2.7/site-packages/django/test/client.py", line 536, in get
**extra)
File "/spare/local/venv/lib/python2.7/site-packages/django/test/client.py", line 340, in get
return self.generic('GET', path, secure=secure, **r)
File "/spare/local/venv/lib/python2.7/site-packages/django/test/client.py", line 416, in generic
return self.request(**r)
File "/spare/local/venv/lib/python2.7/site-packages/django/test/client.py", line 501, in request
six.reraise(*exc_info)
File "/spare/local/venv/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/spare/local/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response
response = self._get_response(request)
File "/spare/local/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/spare/local/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/spare/local/venv/lib/python2.7/site-packages/django/utils/decorators.py", line 185, in inner
return func(*args, **kwargs)
File "/spare/local/venv/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
return view_func(*args, **kwargs)
File "/spare/local/venv/lib/python2.7/site-packages/tastypie/resources.py", line 221, in wrapper
response = callback(request, *args, **kwargs)
File "/spare/local/venv/lib/python2.7/site-packages/tastypie/resources.py", line 470, in dispatch_detail
return self.dispatch('detail', request, **kwargs)
File "/spare/local/venv/lib/python2.7/site-packages/tastypie/resources.py", line 493, in dispatch
response = method(request, **kwargs)
File "/spare/local/venv/lib/python2.7/site-packages/tastypie/resources.py", line 1376, in get_detail
obj = self.cached_obj_get(bundle=basic_bundle, **self.remove_api_resource_names(kwargs))
File "/spare/local/venv/lib/python2.7/site-packages/tastypie/resources.py", line 1195, in cached_obj_get
cached_bundle = self.obj_get(bundle=bundle, **kwargs)
File "/spare/local/venv/lib/python2.7/site-packages/tastypie/resources.py", line 2176, in obj_get
applicable_filters = self.build_filters(filters=kwargs, ignore_bad_filters=True)
TypeError: build_filters() got an unexpected keyword argument 'ignore_bad_filters'
Could your please paste your tastypie resource code?
Without related code, I can only guess that it is because you override
def build_filters(): in your modelresource class, but the newer version of tastypie added a ignore_bad_filter parameter in the function definition which you do not have in your modelresource code.
The build_filters function declaration in the latest tastypie:
def build_filters(self, filters=None, ignore_bad_filters=False):
The old version probably does not have the ignore_bad_filter parameter. To fix this, just add ignore_bad_filters=Falsekey word parameter to the build_filters function in your modelresource class.