[Opensrf-commits] r1774 - trunk/src/python/osrf (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Sep 10 18:25:32 EDT 2009


Author: erickson
Date: 2009-09-10 18:25:26 -0400 (Thu, 10 Sep 2009)
New Revision: 1774

Modified:
   trunk/src/python/osrf/gateway.py
Log:
initial support for capturing bytes read from gateway response

Modified: trunk/src/python/osrf/gateway.py
===================================================================
--- trunk/src/python/osrf/gateway.py	2009-09-10 01:09:03 UTC (rev 1773)
+++ trunk/src/python/osrf/gateway.py	2009-09-10 22:25:26 UTC (rev 1774)
@@ -13,6 +13,7 @@
         self.method = method
         self.params = params
         self.path = 'gateway'
+        self.bytes_read = 0 # for now this, this is really characters read
 
     def setPath(self, path):
         self.path = path
@@ -62,8 +63,11 @@
         return self.getFormat()
 
     def handleResponse(self, response):
-        s = response.read()
-        obj = to_object(s)
+
+        data = response.read()
+        self.bytes_read = len(str(response.headers)) + len(data)
+        obj = to_object(data)
+
         if obj['status'] != 200:
             sys.stderr.write('JSON gateway returned status %d:\n%s\n' % (obj['status'], s))
             return None



More information about the opensrf-commits mailing list