You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2013/12/08 01:01:55 UTC

[3/4] git commit: Add some more comments and missing docstrings.

Add some more comments and missing docstrings.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/028b9922
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/028b9922
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/028b9922

Branch: refs/heads/trunk
Commit: 028b9922bfde24b51ac7116c4cbf39925127402c
Parents: 8068702
Author: Tomaz Muraus <to...@apache.org>
Authored: Sat Dec 7 23:58:07 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sun Dec 8 00:16:47 2013 +0100

----------------------------------------------------------------------
 libcloud/common/base.py | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/028b9922/libcloud/common/base.py
----------------------------------------------------------------------
diff --git a/libcloud/common/base.py b/libcloud/common/base.py
index 940f83e..34d413c 100644
--- a/libcloud/common/base.py
+++ b/libcloud/common/base.py
@@ -69,12 +69,13 @@ class Response(object):
     A base Response class to derive from.
     """
 
-    object = None
-    body = None
-    status = httplib.OK
-    headers = {}
-    error = None
-    connection = None
+    status = httplib.OK  # Response status code
+    headers = {}  # Response headers
+    body = None  # Raw response body
+    object = None  # Parsed response body
+
+    error = None  # Reason returned by the server.
+    connection = None  # Parent connection class
     parse_zero_length_body = False
 
     def __init__(self, response, connection):
@@ -147,9 +148,14 @@ class Response(object):
         headers = lowercase_keys(dict(response.getheaders()))
         encoding = headers.get('content-encoding', None)
 
+        # This attribute is set when using LoggingConnection
         original_data = getattr(response, '_original_data', None)
 
         if original_data is not None:
+            # LoggingConnection decompresses data before we get into this
+            # function so it can log decompressed body.
+            # If this attribute is present, this means the body has already
+            # been decompressed.
             return original_data
 
         body = response.read()