'Response' object has no attribute 'body'

Issue #11 resolved
switchtower
created an issue

Environment:

Request Method: POST Request URL: http://172.16.190.158/admin/django_roa_client/remotepagewithcustomslug/add/

Django Version: 1.3.1 Python Version: 2.6.5 Installed Applications: ['django_roa', 'django_roa.remoteauth', 'django_roa_client', 'django.contrib.auth', 'django.contrib.admin', 'django.contrib.contenttypes', 'django.contrib.sessions'] Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware')

Traceback: File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py" in get_response 111. response = callback(request, callback_args, callback_kwargs) File "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/options.py" in wrapper 307. return self.admin_site.admin_view(view)(*args, kwargs) File "/usr/local/lib/python2.6/dist-packages/django/utils/decorators.py" in _wrapped_view 93. response = view_func(request, args, kwargs) File "/usr/local/lib/python2.6/dist-packages/django/views/decorators/cache.py" in _wrapped_view_func 79. response = view_func(request, *args, kwargs) File "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/sites.py" in inner 197. return view(request, args, kwargs) File "/usr/local/lib/python2.6/dist-packages/django/utils/decorators.py" in _wrapper 28. return bound_func(*args, kwargs) File "/usr/local/lib/python2.6/dist-packages/django/utils/decorators.py" in _wrapped_view 93. response = view_func(request, args, kwargs) File "/usr/local/lib/python2.6/dist-packages/django/utils/decorators.py" in bound_func 24. return func(self, *args2, kwargs2) File "/usr/local/lib/python2.6/dist-packages/django/db/transaction.py" in inner 217. res = func(args, *kwargs) File "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/options.py" in add_view 882. self.save_model(request, new_object, form, change=False) File "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/options.py" in save_model 665. obj.save() File "/root/django-roa/examples/django_roa_client/../django_roa_client/models.py" in save 68. super(RemotePageWithCustomSlug, self).save(force_insert, force_update) File "/usr/local/lib/python2.6/dist-packages/django/db/models/base.py" in save 460. self.save_base(using=using, force_insert=force_insert, force_update=force_update) File "/root/django-roa/django_roa/db/models.py" in save_base 377. response = force_unicode(response.body).encode(settings.DEFAULT_CHARSET)

Exception Type: AttributeError at /admin/django_roa_client/remotepagewithcustomslug/add/ Exception Value: 'Response' object has no attribute 'body'

Comments (5)

  1. Anonymous

    It would appear that calling response.body_string() instead of the response.body (db/query.py) fixes this, I wonder if it's a restkit version issue?

  2. Martin Skala

    That's correct. The problem is fixed, but the code isn't released yet. Hopefully, it'll change soon.

    By the time you can try to install the git version: pip -e hg+https://bitbucket.org/david/django-roa/#egg=django_roa

  3. Log in to comment