changeset 3348:9d726e040fda

better xmlrpc debugging, show raw request data in case of loads exceptions
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 20 Mar 2008 15:30:38 +0100
parents 9ceb503dd7a6
children 81697026ee86
files MoinMoin/xmlrpc/__init__.py
diffstat 1 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/xmlrpc/__init__.py	Thu Mar 20 15:21:23 2008 +0100
+++ b/MoinMoin/xmlrpc/__init__.py	Thu Mar 20 15:30:38 2008 +0100
@@ -133,11 +133,19 @@
                 response = xmlrpclib.Fault(1, "This moin wiki does not allow xmlrpc method calls.")
             else:
                 data = self.request.read()
-                params, method = xmlrpclib.loads(data)
 
-                logging.debug(logging_tearline % 'request begin')
-                logging.debug('%s(%s)' % (method, repr(params)))
-                logging.debug(logging_tearline % 'request end')
+                try:
+                    params, method = xmlrpclib.loads(data)
+                except:
+                    # if anything goes wrong here, we want to see the raw data:
+                    logging.debug(logging_tearline % 'request raw data begin')
+                    logging.debug('%r' % data)
+                    logging.debug(logging_tearline % 'request raw data end')
+                    raise
+
+                logging.debug(logging_tearline % 'request parsed data begin')
+                logging.debug('%s(%r)' % (method, params))
+                logging.debug(logging_tearline % 'request parsed data end')
 
                 response = self.dispatch(method, params)
         except: