Author: tomaz
Date: Sat Feb 25 20:50:46 2012
New Revision: 1293688
URL: http://svn.apache.org/viewvc?rev=1293688&view=rev
Log:
Fix a bug with handling decompressed response in the Linode drivers introduced
in 0.8.0. This patch has been submitted by Ben Agricola <ben dot agricola at
gmail dot com> and is part of LIBCLOUD-158.
Modified:
libcloud/trunk/libcloud/common/linode.py
Modified: libcloud/trunk/libcloud/common/linode.py
URL:
http://svn.apache.org/viewvc/libcloud/trunk/libcloud/common/linode.py?rev=1293688&r1=1293687&r2=1293688&view=diff
==============================================================================
--- libcloud/trunk/libcloud/common/linode.py (original)
+++ libcloud/trunk/libcloud/common/linode.py Sat Feb 25 20:50:46 2012
@@ -16,6 +16,9 @@
from libcloud.common.base import ConnectionKey, JsonResponse
from libcloud.common.types import InvalidCredsError
+from libcloud.utils.py3 import PY3
+from libcloud.utils.py3 import b
+
__all__ = [
'API_HOST',
'API_ROOT',
@@ -79,7 +82,11 @@ class LinodeResponse(JsonResponse):
@keyword response: The raw response returned by urllib
@return: parsed L{LinodeResponse}"""
- self.body = response.read()
+ self.body = self._decompress_response(response=response)
+
+ if PY3:
+ self.body = b(self.body).decode('utf-8')
+
self.status = response.status
self.headers = dict(response.getheaders())
self.error = response.reason