[Opensrf-commits] r1319 - trunk/src/python/osrf

svn at svn.open-ils.org svn at svn.open-ils.org
Wed May 7 13:26:29 EDT 2008


Author: erickson
Date: 2008-05-07 13:26:26 -0400 (Wed, 07 May 2008)
New Revision: 1319

Modified:
   trunk/src/python/osrf/http_translator.py
Log:
set the logging transaction ID earlier in the process

Modified: trunk/src/python/osrf/http_translator.py
===================================================================
--- trunk/src/python/osrf/http_translator.py	2008-05-07 17:26:08 UTC (rev 1318)
+++ trunk/src/python/osrf/http_translator.py	2008-05-07 17:26:26 UTC (rev 1319)
@@ -96,6 +96,16 @@
     def __init__(self, apreq):
 
         self.apreq = apreq
+
+        if OSRF_HTTP_HEADER_XID in apreq.headers_in:
+            osrf.log.log_debug('read XID from client %s' % apreq.headers_in.get(OSRF_HTTP_HEADER_XID))
+            osrf.log.set_xid(apreq.headers_in.get(OSRF_HTTP_HEADER_XID))
+            self.local_xid = False
+        else:
+            osrf.log.make_xid()
+            osrf.log.log_debug('created new XID %s' % osrf.log.get_xid())
+            self.local_xid = True
+
         if apreq.header_only: 
             return
 
@@ -103,7 +113,8 @@
             osrf.log.log_internal('HEADER: %s = %s' % (k, v))
 
         try:
-            post = util.parse_qsl(apreq.read(int(apreq.headers_in['Content-length'])))
+            #post = util.parse_qsl(apreq.read(int(apreq.headers_in['Content-length'])))
+            post = util.parse_qsl(apreq.read())
             osrf.log.log_debug('post = ' + str(post))
             self.body = [d for d in post if d[0] == 'osrf-msg'][0][1]
             osrf.log.log_debug(self.body)
@@ -135,14 +146,6 @@
         self.remote_host = self.apreq.get_remote_host(apache.REMOTE_NOLOOKUP)
         self.cache = osrf.cache.CacheClient()
 
-        if OSRF_HTTP_HEADER_XID in apreq.headers_in:
-            osrf.log.log_debug('read XID from client %s' % apreq.headers_in.get(OSRF_HTTP_HEADER_XID))
-            osrf.log.set_xid(apreq.headers_in.get(OSRF_HTTP_HEADER_XID))
-            self.local_xid = False
-        else:
-            osrf.log.make_xid()
-            osrf.log.log_debug('created new XID %s' % osrf.log.get_xid())
-            self.local_xid = True
 
 
     def process(self):



More information about the opensrf-commits mailing list