Commits

Martin Skala committed 8f117f3

Fix compatibility with restkit 2.2+

Comments (0)

Files changed (4)

django_roa/db/models.py

                 except RequestFailed, e:
                     raise ROAException(e)
             
-            response = force_unicode(response.body).encode(DEFAULT_CHARSET)
+            response = force_unicode(response.body_string()).encode(DEFAULT_CHARSET)
             
             for local_name, remote_name in ROA_MODEL_NAME_MAPPING:
                 response = response.replace(remote_name, local_name)

django_roa/db/query.py

         except Exception, e:
             raise ROAException(e)
 
-        response = force_unicode(response.body).encode(DEFAULT_CHARSET)
+        response = force_unicode(response.body_string()).encode(DEFAULT_CHARSET)
 
         for local_name, remote_name in ROA_MODEL_NAME_MAPPING:
             response = response.replace(remote_name, local_name)
             raise ROAException(e)
         
 
-        response = force_unicode(response.body).encode(DEFAULT_CHARSET)
+        response = force_unicode(response.body_string()).encode(DEFAULT_CHARSET)
 
         for local_name, remote_name in ROA_MODEL_NAME_MAPPING:
             response = response.replace(remote_name, local_name)

examples/django_roa_client/tests.py

         self.assertEqual(repr(page), '<RemotePage: A custom serialized page (1)>')
         r = Resource('http://127.0.0.1:8081/django_roa_server/remotepage/')
         response = r.get(**{'format': 'custom'})
-        self.assertEqual(repr(response.body), '\'<?xml version="1.0" encoding="utf-8"?>\\n<django-test version="1.0">\\n <object pk="1" model="django_roa_server.remotepage">\\n  <field type="CharField" name="title">A custom serialized page</field>\\n </object>\\n</django-test>\'')
+        self.assertEqual(repr(response.body_string()), '\'<?xml version="1.0" encoding="utf-8"?>\\n<django-test version="1.0">\\n <object pk="1" model="django_roa_server.remotepage">\\n  <field type="CharField" name="title">A custom serialized page</field>\\n </object>\\n</django-test>\'')
         self.assertEqual(len(RemotePage.objects.all()), 1)
         page = RemotePage.objects.get(id=page.id)
         self.assertEqual(repr(page), '<RemotePage: A custom serialized page (1)>')
 Django==1.3.1
 PIL==1.1.7
 django-piston==0.2.3
-restkit==2.0.4
+restkit==4.1.2
 wsgiref==0.1.2
 simplejson==2.4.0