Commits

Olemis Lang committed 6939d0f

TracRpc: API v2: Logging event for null JSON-RPC id . What happens?

  • Participants
  • Parent commits 228ef43

Comments (0)

Files changed (1)

File t5437/t5437-protocol_api_v2-r7194.diff

 
 diff -r b5e897b63dc2 trunk/setup.py
 --- a/trunk/setup.py	Thu Mar 18 12:50:57 2010 -0500
-+++ b/trunk/setup.py	Thu Mar 18 13:46:27 2010 -0500
++++ b/trunk/setup.py	Thu Mar 18 14:13:28 2010 -0500
 @@ -28,7 +28,7 @@
      url='http://trac-hacks.org/wiki/XmlRpcPlugin',
      description='RPC interface to Trac',
      package_data={
 diff -r b5e897b63dc2 trunk/tracrpc/api.py
 --- a/trunk/tracrpc/api.py	Thu Mar 18 12:50:57 2010 -0500
-+++ b/trunk/tracrpc/api.py	Thu Mar 18 13:46:27 2010 -0500
++++ b/trunk/tracrpc/api.py	Thu Mar 18 14:13:28 2010 -0500
 @@ -21,13 +21,34 @@
      """ RPC Binary type. Currently == xmlrpclib.Binary. """
      pass
  
 diff -r b5e897b63dc2 trunk/tracrpc/json_rpc.py
 --- a/trunk/tracrpc/json_rpc.py	Thu Mar 18 12:50:57 2010 -0500
-+++ b/trunk/tracrpc/json_rpc.py	Thu Mar 18 13:46:27 2010 -0500
++++ b/trunk/tracrpc/json_rpc.py	Thu Mar 18 14:13:28 2010 -0500
 @@ -5,8 +5,9 @@
  (c) 2009      ::: www.CodeResort.com - BV Network AS (simon-code@bvnetwork.no)
  """
  class JsonRpcProtocol(Component):
      r"""
      Example `POST` request using `curl` with `Content-Type` header
-@@ -126,34 +133,40 @@
+@@ -126,34 +133,41 @@
          # Legacy path - provided for backwards compatibility:
          yield ('jsonrpc', 'application/json')
  
 +                # Prepare for multicall
 +                for signature in data.itervalues() :
 +                    signature['methodName'] = signature.get('method', '')
++            self.log.info("RPC(json) JSON-RPC request ID : %s.", data.get('id'))
 +            return data
          except Exception, e:
              # Abort with exception - no data can be read
              try: # JSON encoding
                  self.log.debug("RPC(json) result: %s" % repr(response))
                  response = json.dumps(response, cls=TracRpcJSONEncoder)
-@@ -166,7 +179,13 @@
+@@ -166,7 +180,13 @@
              response = json.dumps(self._json_error(e, r_id=r_id),
                              cls=TracRpcJSONEncoder)
          self.log.debug("RPC(json) encoded result: %s" % response)
  
      # Internal methods
  
-@@ -178,14 +197,11 @@
+@@ -178,14 +198,11 @@
          req.end_headers()
          req.write(response)
  
      def _json_error(self, e, c=None, r_id=None):
 diff -r b5e897b63dc2 trunk/tracrpc/tests/__init__.py
 --- a/trunk/tracrpc/tests/__init__.py	Thu Mar 18 12:50:57 2010 -0500
-+++ b/trunk/tracrpc/tests/__init__.py	Thu Mar 18 13:46:27 2010 -0500
++++ b/trunk/tracrpc/tests/__init__.py	Thu Mar 18 14:13:28 2010 -0500
 @@ -35,6 +35,7 @@
              print "Enabling RPC plugin and permissions..."
              env.config.set('components', 'tracrpc.*', 'enabled')
 +        assertRaises = failUnlessRaises
 diff -r b5e897b63dc2 trunk/tracrpc/tests/api.py
 --- a/trunk/tracrpc/tests/api.py	Thu Mar 18 12:50:57 2010 -0500
-+++ b/trunk/tracrpc/tests/api.py	Thu Mar 18 13:46:27 2010 -0500
++++ b/trunk/tracrpc/tests/api.py	Thu Mar 18 14:13:28 2010 -0500
 @@ -9,14 +9,14 @@
  import unittest
  import urllib2
 +    unittest.main(defaultTest='test_suite')
 diff -r b5e897b63dc2 trunk/tracrpc/tests/json_rpc.py
 --- a/trunk/tracrpc/tests/json_rpc.py	Thu Mar 18 12:50:57 2010 -0500
-+++ b/trunk/tracrpc/tests/json_rpc.py	Thu Mar 18 13:46:27 2010 -0500
++++ b/trunk/tracrpc/tests/json_rpc.py	Thu Mar 18 14:13:28 2010 -0500
 @@ -14,10 +14,10 @@
  from tracrpc.util import StringIO
  
 +    unittest.main(defaultTest='test_suite')
 diff -r b5e897b63dc2 trunk/tracrpc/tests/ticket.py
 --- a/trunk/tracrpc/tests/ticket.py	Thu Mar 18 12:50:57 2010 -0500
-+++ b/trunk/tracrpc/tests/ticket.py	Thu Mar 18 13:46:27 2010 -0500
++++ b/trunk/tracrpc/tests/ticket.py	Thu Mar 18 14:13:28 2010 -0500
 @@ -12,9 +12,9 @@
  import shutil
  import time
 +    unittest.main(defaultTest='test_suite')
 diff -r b5e897b63dc2 trunk/tracrpc/tests/wiki.py
 --- a/trunk/tracrpc/tests/wiki.py	Thu Mar 18 12:50:57 2010 -0500
-+++ b/trunk/tracrpc/tests/wiki.py	Thu Mar 18 13:46:27 2010 -0500
++++ b/trunk/tracrpc/tests/wiki.py	Thu Mar 18 14:13:28 2010 -0500
 @@ -13,10 +13,10 @@
  
  from trac.util.compat import sorted
 +    unittest.main(defaultTest='test_suite')
 diff -r b5e897b63dc2 trunk/tracrpc/tests/xml_rpc.py
 --- a/trunk/tracrpc/tests/xml_rpc.py	Thu Mar 18 12:50:57 2010 -0500
-+++ b/trunk/tracrpc/tests/xml_rpc.py	Thu Mar 18 13:46:27 2010 -0500
++++ b/trunk/tracrpc/tests/xml_rpc.py	Thu Mar 18 14:13:28 2010 -0500
 @@ -9,9 +9,9 @@
  
  import xmlrpclib
 +    unittest.main(defaultTest='test_suite')
 diff -r b5e897b63dc2 trunk/tracrpc/web_ui.py
 --- a/trunk/tracrpc/web_ui.py	Thu Mar 18 12:50:57 2010 -0500
-+++ b/trunk/tracrpc/web_ui.py	Thu Mar 18 13:46:27 2010 -0500
++++ b/trunk/tracrpc/web_ui.py	Thu Mar 18 14:13:28 2010 -0500
 @@ -6,6 +6,10 @@
  (c) 2009      ::: www.CodeResort.com - BV Network AS (simon-code@bvnetwork.no)
  """
      def get_htdocs_dirs(self):
 diff -r b5e897b63dc2 trunk/tracrpc/xml_rpc.py
 --- a/trunk/tracrpc/xml_rpc.py	Thu Mar 18 12:50:57 2010 -0500
-+++ b/trunk/tracrpc/xml_rpc.py	Thu Mar 18 13:46:27 2010 -0500
++++ b/trunk/tracrpc/xml_rpc.py	Thu Mar 18 14:13:28 2010 -0500
 @@ -19,7 +19,7 @@
  from trac.util.text import to_unicode