[Opensrf-commits] r1956 - trunk/src/python/osrf (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Sun May 23 18:26:16 EDT 2010
Author: erickson
Date: 2010-05-23 18:26:09 -0400 (Sun, 23 May 2010)
New Revision: 1956
Modified:
trunk/src/python/osrf/gateway.py
Log:
added some debugging / sanity checks to python gateway response handler
Modified: trunk/src/python/osrf/gateway.py
===================================================================
--- trunk/src/python/osrf/gateway.py 2010-05-07 20:18:36 UTC (rev 1955)
+++ trunk/src/python/osrf/gateway.py 2010-05-23 22:26:09 UTC (rev 1956)
@@ -69,14 +69,15 @@
obj = to_object(data)
if obj['status'] != 200:
- sys.stderr.write('JSON gateway returned status %d:\n%s\n' % (obj['status'], s))
+ sys.stderr.write('JSON gateway returned status %d:\n' % (obj['status']))
return None
# the gateway wraps responses in an array to handle streaming data
# if there is only one item in the array, it (probably) wasn't a streaming request
p = obj['payload']
if len(p) > 1: return p
- return p[0]
+ if len(p): return p[0]
+ return None
def encodeParam(self, param):
return osrf.json.to_json(param)
More information about the opensrf-commits
mailing list