Commits

Olemis Lang committed 73ec674

TracRpc: API v2: Renaming

Comments (0)

Files changed (1)

t5437/t5437-protocol_api_v2-r7194.diff

 RPC Protocol API version 2
 
-diff -r 369fe39e568b trunk/setup.py
---- a/trunk/setup.py	Sat Mar 27 18:21:41 2010 -0500
-+++ b/trunk/setup.py	Thu Apr 08 22:58:08 2010 -0500
+diff -r de4ed975fd30 trunk/setup.py
+--- a/trunk/setup.py	Fri Apr 09 09:01:40 2010 -0500
++++ b/trunk/setup.py	Tue Apr 13 12:38:15 2010 -0500
 @@ -28,7 +28,7 @@
      url='http://trac-hacks.org/wiki/XmlRpcPlugin',
      description='RPC interface to Trac',
      tests_require = test_deps,
      packages=find_packages(exclude=['*.tests']),
      package_data={
-diff -r 369fe39e568b trunk/tracrpc/api.py
---- a/trunk/tracrpc/api.py	Sat Mar 27 18:21:41 2010 -0500
-+++ b/trunk/tracrpc/api.py	Thu Apr 08 22:58:08 2010 -0500
-@@ -21,13 +21,34 @@
+diff -r de4ed975fd30 trunk/tracrpc/api.py
+--- a/trunk/tracrpc/api.py	Fri Apr 09 09:01:40 2010 -0500
++++ b/trunk/tracrpc/api.py	Tue Apr 13 12:38:15 2010 -0500
+@@ -15,19 +15,41 @@
+ from trac.perm import IPermissionRequestor
+ 
+ __all__ = ['expose_rpc', 'IRPCProtocol', 'IXMLRPCHandler', 'AbstractRPCHandler',
+-            'Method', 'XMLRPCSystem', 'Binary', 'RPCError']
++            'Method', 'XMLRPCSystem', 'Binary', 'RPCError', 'MethodNotFound', 
++            'ProtocolException', 'ServiceException']
+ 
+ class Binary(xmlrpclib.Binary):
      """ RPC Binary type. Currently == xmlrpclib.Binary. """
      pass
  
  
  RPC_TYPES = {int: 'int', bool: 'boolean', str: 'string', float: 'double',
               datetime: 'dateTime.iso8601', Binary: 'base64',
-@@ -63,8 +84,58 @@
+@@ -63,8 +85,58 @@
                     (/login)?/<path_item>. Answer to 'rpc' only if possible.
          content_type: Starts-with check of 'Content-Type' request header. """
  
  
  class IXMLRPCHandler(Interface):
  
-diff -r 369fe39e568b trunk/tracrpc/json_rpc.py
---- a/trunk/tracrpc/json_rpc.py	Sat Mar 27 18:21:41 2010 -0500
-+++ b/trunk/tracrpc/json_rpc.py	Thu Apr 08 22:58:08 2010 -0500
+diff -r de4ed975fd30 trunk/tracrpc/json_rpc.py
+--- a/trunk/tracrpc/json_rpc.py	Fri Apr 09 09:01:40 2010 -0500
++++ b/trunk/tracrpc/json_rpc.py	Tue Apr 13 12:38:15 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 +134,48 @@
+@@ -126,34 +134,46 @@
          # Legacy path - provided for backwards compatibility:
          yield ('jsonrpc', 'application/json')
  
 +                                        sig.get('id') or r_id) \
 +                              for sig, value in izip(args, result)]
 +                
-+                # TODO: Which one is better ?
-+                # response = self._json_result(req, mcresults, r_id)
-+                response = {'result': mcresults, 'error': None, 'id': r_id}
++                response = self._json_result(mcresults, r_id)
              else:
 -                response = self._json_call(req, method, args, r_id)
 +                response = self._json_result(result, r_id)
              try: # JSON encoding
                  self.log.debug("RPC(json) result: %s" % repr(response))
                  response = json.dumps(response, cls=TracRpcJSONEncoder)
-@@ -165,28 +187,35 @@
+@@ -165,28 +185,35 @@
                                                      traceback=True))
              response = json.dumps(self._json_error(e, r_id=r_id),
                              cls=TracRpcJSONEncoder)
  
      def _json_error(self, e, c=None, r_id=None):
          """ Makes a response dictionary that is an error. """
-diff -r 369fe39e568b trunk/tracrpc/tests/__init__.py
---- a/trunk/tracrpc/tests/__init__.py	Sat Mar 27 18:21:41 2010 -0500
-+++ b/trunk/tracrpc/tests/__init__.py	Thu Apr 08 22:58:08 2010 -0500
+diff -r de4ed975fd30 trunk/tracrpc/tests/__init__.py
+--- a/trunk/tracrpc/tests/__init__.py	Fri Apr 09 09:01:40 2010 -0500
++++ b/trunk/tracrpc/tests/__init__.py	Tue Apr 13 12:38:15 2010 -0500
 @@ -35,6 +35,7 @@
              print "Enabling RPC plugin and permissions..."
              env.config.set('components', 'tracrpc.*', 'enabled')
 +                raise self.failureException, "Expected %s\n\nNothing raised" % excName
 +
 +        assertRaises = failUnlessRaises
-diff -r 369fe39e568b trunk/tracrpc/tests/api.py
-Binary file trunk/tracrpc/tests/api.py has changed
-diff -r 369fe39e568b trunk/tracrpc/tests/json_rpc.py
---- a/trunk/tracrpc/tests/json_rpc.py	Sat Mar 27 18:21:41 2010 -0500
-+++ b/trunk/tracrpc/tests/json_rpc.py	Thu Apr 08 22:58:08 2010 -0500
+diff -r de4ed975fd30 trunk/tracrpc/tests/api.py
+--- a/trunk/tracrpc/tests/api.py	Fri Apr 09 09:01:40 2010 -0500
++++ b/trunk/tracrpc/tests/api.py	Tue Apr 13 12:38:15 2010 -0500
+@@ -100,8 +100,8 @@
+             os.unlink(provider)
+             rpc_testenv.restart()
+ 
+-def suite():
++def test_suite():
+     return unittest.makeSuite(ProtocolProviderTestCase)
+ 
+ if __name__ == '__main__':
+-    unittest.main(defaultTest='suite')
++    unittest.main(defaultTest='test_suite')
+diff -r de4ed975fd30 trunk/tracrpc/tests/json_rpc.py
+--- a/trunk/tracrpc/tests/json_rpc.py	Fri Apr 09 09:01:40 2010 -0500
++++ b/trunk/tracrpc/tests/json_rpc.py	Tue Apr 13 12:38:15 2010 -0500
 @@ -14,10 +14,10 @@
  from tracrpc.util import StringIO
  
  if __name__ == '__main__':
 -    unittest.main(defaultTest='suite')
 +    unittest.main(defaultTest='test_suite')
-diff -r 369fe39e568b trunk/tracrpc/tests/ticket.py
---- a/trunk/tracrpc/tests/ticket.py	Sat Mar 27 18:21:41 2010 -0500
-+++ b/trunk/tracrpc/tests/ticket.py	Thu Apr 08 22:58:08 2010 -0500
+diff -r de4ed975fd30 trunk/tracrpc/tests/ticket.py
+--- a/trunk/tracrpc/tests/ticket.py	Fri Apr 09 09:01:40 2010 -0500
++++ b/trunk/tracrpc/tests/ticket.py	Tue Apr 13 12:38:15 2010 -0500
 @@ -12,9 +12,9 @@
  import shutil
  import time
  if __name__ == '__main__':
 -    unittest.main(defaultTest='suite')
 +    unittest.main(defaultTest='test_suite')
-diff -r 369fe39e568b trunk/tracrpc/tests/wiki.py
---- a/trunk/tracrpc/tests/wiki.py	Sat Mar 27 18:21:41 2010 -0500
-+++ b/trunk/tracrpc/tests/wiki.py	Thu Apr 08 22:58:08 2010 -0500
+diff -r de4ed975fd30 trunk/tracrpc/tests/wiki.py
+--- a/trunk/tracrpc/tests/wiki.py	Fri Apr 09 09:01:40 2010 -0500
++++ b/trunk/tracrpc/tests/wiki.py	Tue Apr 13 12:38:15 2010 -0500
 @@ -13,10 +13,10 @@
  
  from trac.util.compat import sorted
  if __name__ == '__main__':
 -    unittest.main(defaultTest='suite')
 +    unittest.main(defaultTest='test_suite')
-diff -r 369fe39e568b trunk/tracrpc/tests/xml_rpc.py
---- a/trunk/tracrpc/tests/xml_rpc.py	Sat Mar 27 18:21:41 2010 -0500
-+++ b/trunk/tracrpc/tests/xml_rpc.py	Thu Apr 08 22:58:08 2010 -0500
+diff -r de4ed975fd30 trunk/tracrpc/tests/xml_rpc.py
+--- a/trunk/tracrpc/tests/xml_rpc.py	Fri Apr 09 09:01:40 2010 -0500
++++ b/trunk/tracrpc/tests/xml_rpc.py	Tue Apr 13 12:38:15 2010 -0500
 @@ -9,9 +9,9 @@
  
  import xmlrpclib
  if __name__ == '__main__':
 -    unittest.main(defaultTest='suite')
 +    unittest.main(defaultTest='test_suite')
-diff -r 369fe39e568b trunk/tracrpc/web_ui.py
---- a/trunk/tracrpc/web_ui.py	Sat Mar 27 18:21:41 2010 -0500
-+++ b/trunk/tracrpc/web_ui.py	Thu Apr 08 22:58:08 2010 -0500
+diff -r de4ed975fd30 trunk/tracrpc/web_ui.py
+--- a/trunk/tracrpc/web_ui.py	Fri Apr 09 09:01:40 2010 -0500
++++ b/trunk/tracrpc/web_ui.py	Tue Apr 13 12:38:15 2010 -0500
 @@ -6,6 +6,10 @@
  (c) 2009      ::: www.CodeResort.com - BV Network AS (simon-code@bvnetwork.no)
  """
      # ITemplateProvider methods
  
      def get_htdocs_dirs(self):
-diff -r 369fe39e568b trunk/tracrpc/xml_rpc.py
---- a/trunk/tracrpc/xml_rpc.py	Sat Mar 27 18:21:41 2010 -0500
-+++ b/trunk/tracrpc/xml_rpc.py	Thu Apr 08 22:58:08 2010 -0500
+diff -r de4ed975fd30 trunk/tracrpc/xml_rpc.py
+--- a/trunk/tracrpc/xml_rpc.py	Fri Apr 09 09:01:40 2010 -0500
++++ b/trunk/tracrpc/xml_rpc.py	Tue Apr 13 12:38:15 2010 -0500
 @@ -19,7 +19,7 @@
  from trac.util.text import to_unicode