[Opensrf-commits] r1328 - trunk/src/python/osrf
svn at svn.open-ils.org
svn at svn.open-ils.org
Sun May 18 19:42:18 EDT 2008
Author: erickson
Date: 2008-05-18 19:42:17 -0400 (Sun, 18 May 2008)
New Revision: 1328
Modified:
trunk/src/python/osrf/http_translator.py
Log:
No longer globally setting the network recv_callback handler to None
because it clobbers the callbacks of other python clients running
in the same within the same process. Now we capture the existing
callback and replace it after the request has been processed
Modified: trunk/src/python/osrf/http_translator.py
===================================================================
--- trunk/src/python/osrf/http_translator.py 2008-05-18 22:17:59 UTC (rev 1327)
+++ trunk/src/python/osrf/http_translator.py 2008-05-18 23:42:17 UTC (rev 1328)
@@ -85,11 +85,22 @@
def handler(req):
''' Create the translator and tell it to process the request. '''
child_init(req)
- translator = HTTPTranslator(req)
- status = translator.process()
- osrf.log.log_debug("translator call resulted in status %d" % int(status))
- if translator.local_xid:
- osrf.log.clear_xid()
+
+ # capture the callback handle, clear it, then reset
+ # it after we've handled the request
+ handle = osrf.net.get_network_handle()
+ callback = handle.receive_callback
+ handle.set_receive_callback(None)
+
+ try:
+ translator = HTTPTranslator(req)
+ status = translator.process()
+ osrf.log.log_debug("translator call resulted in status %d" % int(status))
+ if translator.local_xid:
+ osrf.log.clear_xid()
+ finally:
+ handle.receive_callback = callback
+
return status
class HTTPTranslator(object):
@@ -126,7 +137,6 @@
self.messages = []
self.complete = False
self.handle = osrf.net.get_network_handle()
- self.handle.set_receive_callback(None)
self.recipient = apreq.headers_in.get(OSRF_HTTP_HEADER_TO)
self.service = apreq.headers_in.get(OSRF_HTTP_HEADER_SERVICE)
More information about the opensrf-commits
mailing list