Commits

Olemis Lang committed f7fd465

TracRpc: Removed call to `rpc_match` inside `rpc_info`. + docs ;o)

  • Participants
  • Parent commits 4f7b4ac

Comments (0)

Files changed (2)

 # TODO: Types cleanup (Binary + datetime + all method docs)
 # TODO: Clean up method docs to not presume specific protocols
 # TODO: Abstract _send_error() using regular http status codes, and let each make the appropriate type of request
-# TODO: Expand Genshi template expressions in protocol provider docs
+# TODO: Add RPC handler (method ?) to list details about installed protocols
 t5437/t5437-protocol_api-r7194.diff
 

File t5437/t5437-protocol_api-r7194.diff

  try:
      set = set
  except:
-@@ -35,7 +38,29 @@
+@@ -35,7 +38,28 @@
      return decorator
  
  
 +class IRPCProtocol(Interface):
 +    
 +    def rpc_info():
-+        """ Returns a tuple of (name, docs, urlmap). Method provides
++        """ Returns a tuple of (name, docs). Method provides
 +        general information about the protocol used for the RPC HTML view.
 +        name: Shortname like 'XML-RPC'
-+        docs: HTML rendered documentation for the protocol
-+        urlmap: a sequence of protocol path and content type pairs
++        docs: WikiFormatting representing documentation for the protocol
 +        """
 +
 +    def rpc_match():
      def xmlrpc_namespace():
          """ Provide the namespace in which a set of methods lives.
              This can be overridden if the 'name' element is provided by
-@@ -56,7 +81,6 @@
+@@ -56,7 +80,6 @@
          followed by argument types.
          """
  
 +    # IRPCProtocol methods
 +
 +    def rpc_info(self):
-+        return ('JSON-RPC', prepare_docs(self.__doc__), list(self.rpc_match()))
++        return ('JSON-RPC', prepare_docs(self.__doc__))
 +
 +    def rpc_match(self):
 +        yield('rpc', 'application/json')
 new file mode 100644
 --- /dev/null
 +++ b/trunk/tracrpc/templates/rpc_main.html
-@@ -0,0 +1,73 @@
+@@ -0,0 +1,79 @@
 +<!DOCTYPE html
 +    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 +    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 +  <body>
 +    <div id="content" class="wiki">
 +      <div class="wikipage searchable">
-+        <h1>Remote Procedure Call (RPC) Interface</h1>
++        <h1>Remote Procedure Call (RPC) Protocols</h1>
++        <p>Since <i>version 1.0.7</i> it is possible to invoke 
++          <a href="${req.abs_href.rpc('api')}">the methods available 
++          in your environment</a> via many different protocols. Users 
++          can even implement another protocol in a plugin and install 
++          it at any time.
++        </p>
 +        <h2>Protocol reference:</h2>
 +        <p>Below you will find a detailed description of all the RPC 
 +          protocols installed in this environment. This includes 
 diff --git a/trunk/tracrpc/web_ui.py b/trunk/tracrpc/web_ui.py
 --- a/trunk/tracrpc/web_ui.py
 +++ b/trunk/tracrpc/web_ui.py
-@@ -6,305 +6,143 @@
+@@ -6,305 +6,144 @@
  (c) 2009      ::: www.CodeResort.com - BV Network AS (simon-code@bvnetwork.no)
  """
  
 +            template = 'main'
 +        return ('rpc_%s.html' % template, 
 +                    {'rpc': {'functions': namespaces,
-+                      'protocols': [p.rpc_info() for p in self.protocols],
++                      'protocols': [p.rpc_info() + (list(p.rpc_match()),) \
++                                      for p in self.protocols],
 +                      'proto_id' : None},
 +                    'expand_docs': self._expand_docs
 +                    },
 +    <value><string>= Welcome to....
 +    }}}
 +
-+    The following snippet illustrates how to perform authenticated calls in python.
++    The following snippet illustrates how to perform authenticated calls in Python.
 +
 +    {{{
 +    >>> from xmlrpclib import ServerProxy
 +    # IRPCProtocol methods
 +
 +    def rpc_info(self):
-+        return ('XML-RPC', prepare_docs(self.__doc__), list(self.rpc_match()))
++        return ('XML-RPC', prepare_docs(self.__doc__))
 +
 +    def rpc_match(self):
 +        yield ('rpc', 'application/xml')