Commits

Olemis Lang committed a866ac0

TracRpc: Grouping RPC URLs by content type in docs

Comments (0)

Files changed (2)

t5437/t5437-protocol_api-r7194.diff

 new file mode 100644
 --- /dev/null
 +++ b/trunk/tracrpc/templates/rpc.html
-@@ -0,0 +1,80 @@
+@@ -0,0 +1,86 @@
 +<!DOCTYPE html
 +    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 +    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 +          <dd>
 +            <p>For ${protocol[0]} protocol, use any one of:</p>
 +            <ul>
-+              <li py:for="h, ct in protocol[2]">
++              <li py:for="ct, _ct_group in groupby(protocol[2], lambda (_, x) : x)">
 +                <tt>{'Content-Type': '$ct'}</tt> header with request to:
-+                <ul>
-+                  <li><a href="${req.abs_href(h)}">${req.abs_href(h)}</a> 
-+                  for anonymous access</li>
-+                  <li><a href="${req.abs_href.login(h)}">${req.abs_href.login(h)}</a>
-+                  for authenticated access</li>
-+                </ul>
++                <py:with vars="ct_group = list(_ct_group)">
++                  <ul>
++                    <li py:for="h, _ in ct_group">
++                      <a href="${req.abs_href(h)}">${req.abs_href(h)}</a> 
++                      for anonymous access
++                    </li>
++                    <li py:for="h, _ in ct_group">
++                      <a href="${req.abs_href.login(h)}">${req.abs_href.login(h)}</a>
++                      for authenticated access
++                    </li>
++                  </ul>
++                </py:with>
 +              </li>
 +            </ul>
 +          <div>
 new file mode 100644
 --- /dev/null
 +++ b/trunk/tracrpc/xml_rpc.py
-@@ -0,0 +1,194 @@
+@@ -0,0 +1,195 @@
 +# -*- coding: utf-8 -*-
 +"""
 +License: BSD
 +        return ('XML-RPC', prepare_docs(self.__doc__))
 +
 +    def rpc_match(self):
++        # Legacy path xmlrpc provided for backwards compatibility:
++        # Using this order to get better docs 
 +        yield ('rpc', 'application/xml')
++        yield ('xmlrpc', 'application/xml')
 +        yield ('rpc', 'text/xml')
-+        # Legacy path - provided for backwards compatibility:
-+        yield ('xmlrpc', 'application/xml')
 +        yield ('xmlrpc', 'text/xml')
 +
 +    def rpc_process(self, req, content_type):

t5437/t5437-protocol_api_v2-r7194.diff

 RPC Protocol API version 2
 
-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
+diff -r 1f87dee9169c trunk/setup.py
+--- a/trunk/setup.py	Thu Apr 15 09:30:33 2010 -0500
++++ b/trunk/setup.py	Thu Apr 15 09:42: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 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
+diff -r 1f87dee9169c trunk/tracrpc/api.py
+--- a/trunk/tracrpc/api.py	Thu Apr 15 09:30:33 2010 -0500
++++ b/trunk/tracrpc/api.py	Thu Apr 15 09:42:15 2010 -0500
 @@ -15,19 +15,41 @@
  from trac.perm import IPermissionRequestor
  
  
  class IXMLRPCHandler(Interface):
  
-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
+diff -r 1f87dee9169c trunk/tracrpc/json_rpc.py
+--- a/trunk/tracrpc/json_rpc.py	Thu Apr 15 09:30:33 2010 -0500
++++ b/trunk/tracrpc/json_rpc.py	Thu Apr 15 09:42:15 2010 -0500
 @@ -5,8 +5,9 @@
  (c) 2009      ::: www.CodeResort.com - BV Network AS (simon-code@bvnetwork.no)
  """
  
      def _json_error(self, e, c=None, r_id=None):
          """ Makes a response dictionary that is an error. """
-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
+diff -r 1f87dee9169c trunk/tracrpc/tests/__init__.py
+--- a/trunk/tracrpc/tests/__init__.py	Thu Apr 15 09:30:33 2010 -0500
++++ b/trunk/tracrpc/tests/__init__.py	Thu Apr 15 09:42: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 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
+diff -r 1f87dee9169c trunk/tracrpc/tests/api.py
+--- a/trunk/tracrpc/tests/api.py	Thu Apr 15 09:30:33 2010 -0500
++++ b/trunk/tracrpc/tests/api.py	Thu Apr 15 09:42:15 2010 -0500
 @@ -100,8 +100,8 @@
              os.unlink(provider)
              rpc_testenv.restart()
  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
+diff -r 1f87dee9169c trunk/tracrpc/tests/json_rpc.py
+--- a/trunk/tracrpc/tests/json_rpc.py	Thu Apr 15 09:30:33 2010 -0500
++++ b/trunk/tracrpc/tests/json_rpc.py	Thu Apr 15 09:42: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 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
+diff -r 1f87dee9169c trunk/tracrpc/tests/ticket.py
+--- a/trunk/tracrpc/tests/ticket.py	Thu Apr 15 09:30:33 2010 -0500
++++ b/trunk/tracrpc/tests/ticket.py	Thu Apr 15 09:42: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 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
+diff -r 1f87dee9169c trunk/tracrpc/tests/wiki.py
+--- a/trunk/tracrpc/tests/wiki.py	Thu Apr 15 09:30:33 2010 -0500
++++ b/trunk/tracrpc/tests/wiki.py	Thu Apr 15 09:42: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 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
+diff -r 1f87dee9169c trunk/tracrpc/tests/xml_rpc.py
+--- a/trunk/tracrpc/tests/xml_rpc.py	Thu Apr 15 09:30:33 2010 -0500
++++ b/trunk/tracrpc/tests/xml_rpc.py	Thu Apr 15 09:42:15 2010 -0500
 @@ -9,9 +9,9 @@
  
  import xmlrpclib
  if __name__ == '__main__':
 -    unittest.main(defaultTest='suite')
 +    unittest.main(defaultTest='test_suite')
-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
+diff -r 1f87dee9169c trunk/tracrpc/web_ui.py
+--- a/trunk/tracrpc/web_ui.py	Thu Apr 15 09:30:33 2010 -0500
++++ b/trunk/tracrpc/web_ui.py	Thu Apr 15 09:42: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 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
+diff -r 1f87dee9169c trunk/tracrpc/xml_rpc.py
+--- a/trunk/tracrpc/xml_rpc.py	Thu Apr 15 09:30:33 2010 -0500
++++ b/trunk/tracrpc/xml_rpc.py	Thu Apr 15 09:42:15 2010 -0500
 @@ -19,7 +19,7 @@
  from trac.util.text import to_unicode
  
  from tracrpc.util import empty, prepare_docs
  
  __all__ = ['XmlRpcProtocol']
-@@ -81,41 +81,48 @@
-         yield ('xmlrpc', 'application/xml')
+@@ -82,41 +82,48 @@
+         yield ('rpc', 'text/xml')
          yield ('xmlrpc', 'text/xml')
  
 -    def rpc_process(self, req, content_type):
              self.log.error(e)
              import traceback
              from tracrpc.util import StringIO
-@@ -123,6 +130,7 @@
+@@ -124,6 +131,7 @@
              traceback.print_exc(file = out)
              self.log.error(out.getvalue())
              err_code = hasattr(e, 'code') and e.code or 1