Commits

Anonymous committed c88ced9

[svn r11410] XmlRpcPlugin: Small fix + test to gracefully handle running Python optimized (`-OO`) that may in fact strip all docstrings (leaving them as `None`). Fixes #9919.

Running `python -OO setup.py test` will now at least fail this new test that depends on ability to introspect docstrings.

Comments (0)

Files changed (2)

trunk/tracrpc/tests/api.py

             self.assertEquals(e.fp.read(),
                 "No protocol matching Content-Type 'text/plain' at path '/rpc'.")
 
+    def test_rpc_info(self):
+        # Just try getting the docs for XML-RPC to test, it should always exist
+        from tracrpc.xml_rpc import XmlRpcProtocol
+        xmlrpc = XmlRpcProtocol(rpc_testenv.get_trac_environment())
+        name, docs = xmlrpc.rpc_info()
+        self.assertEquals(name, 'XML-RPC')
+        self.assertTrue('Content-Type: application/xml' in docs)
+
     def test_valid_provider(self):
         # Confirm the request won't work before adding plugin
         req = urllib2.Request(rpc_testenv.url_anon,

trunk/tracrpc/util.py

 
 def prepare_docs(text, indent=4):
     r"""Remove leading whitespace"""
-    return ''.join(l[indent:] for l in text.splitlines(True))
+    return text and ''.join(l[indent:] for l in text.splitlines(True)) or ''
 
 try:
     # Micro-second support added to 0.12dev r9210
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.