Source

trac-rpc-mq / t5437 / t5437-final_review-r7194.diff

Full commit
# HG changeset patch
# Parent 940c07799bf878f30761c25d65dc145f62277a00

diff --git a/trunk/MANIFEST.in b/trunk/MANIFEST.in
--- a/trunk/MANIFEST.in
+++ b/trunk/MANIFEST.in
@@ -1,4 +1,5 @@
 include README.wiki
-include tracrpc/htdocs/css/*.css
-include tracrpc/htdocs/js/*.js
+include setup.cfg
+include tracrpc/htdocs/*.css
+include tracrpc/htdocs/*.js
 include tracrpc/templates/*.html
diff --git a/trunk/setup.py b/trunk/setup.py
--- a/trunk/setup.py
+++ b/trunk/setup.py
@@ -32,8 +32,7 @@
     tests_require = test_deps,
     packages=find_packages(exclude=['*.tests']),
     package_data={
-        'tracrpc': ['templates/*.html', 'htdocs/js/*.js', \
-                    'htdocs/css/*.css']
+        'tracrpc': ['templates/*.html', 'htdocs/*.js', 'htdocs/*.css']
         },
     entry_points={
         'trac.plugins': 'TracXMLRPC = tracrpc'
diff --git a/trunk/tracrpc/api.py b/trunk/tracrpc/api.py
--- a/trunk/tracrpc/api.py
+++ b/trunk/tracrpc/api.py
@@ -336,4 +336,4 @@
         indicate API breaking changes, while minor version changes are simple
         additions, bug fixes, etc. """
         import tracrpc
-        return map(int, tracrpc.__version__.split('.'))
+        return map(int, tracrpc.__version__.split('-')[0].split('.'))
diff --git a/trunk/tracrpc/htdocs/css/rpc.css b/trunk/tracrpc/htdocs/rpc.css
rename from trunk/tracrpc/htdocs/css/rpc.css
rename to trunk/tracrpc/htdocs/rpc.css
diff --git a/trunk/tracrpc/htdocs/js/rpc.js b/trunk/tracrpc/htdocs/rpc.js
rename from trunk/tracrpc/htdocs/js/rpc.js
rename to trunk/tracrpc/htdocs/rpc.js
diff --git a/trunk/tracrpc/json_rpc.py b/trunk/tracrpc/json_rpc.py
--- a/trunk/tracrpc/json_rpc.py
+++ b/trunk/tracrpc/json_rpc.py
@@ -138,7 +138,6 @@
         """ Parse JSON-RPC requests"""
         if not json:
             self.log.debug("RPC(json) call ignored (not available).")
-            # TODO: Specify correponding error code
             raise JsonProtocolException("Error: JSON-RPC not available.\n")
         try:
             data = json.load(req, cls=TracRpcJSONDecoder)
@@ -189,7 +188,6 @@
 
     def send_rpc_error(self, req, e):
         """Send a JSON-RPC fault message back to the caller. """
-        # TODO : Check error codes and RPC exceptions
         rpcreq = req.rpc
         r_id = rpcreq.get('id')
         response = json.dumps(self._json_error(e, r_id=r_id), \
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
@@ -7,7 +7,6 @@
 """
 
 import sys
-from traceback import format_exc
 from types import GeneratorType
 
 from pkg_resources import resource_filename
@@ -110,8 +109,8 @@
                 raise Exception('%s: %s\n%s' % (method.name,
                                                 str(e), out.getvalue()))
         add_stylesheet(req, 'common/css/wiki.css')
-        add_stylesheet(req, 'tracrpc/css/rpc.css')
-        add_script(req, 'tracrpc/js/rpc.js')
+        add_stylesheet(req, 'tracrpc/rpc.css')
+        add_script(req, 'tracrpc/rpc.js')
         return ('rpc.html', 
                 {'rpc': {'functions': namespaces,
                          'protocols': [p.rpc_info() + (list(p.rpc_match()),) \
@@ -182,15 +181,9 @@
 
     def _send_unknown_error(self, req, e):
         """Last recourse if protocol cannot handle the RPC request | error"""
-
-        # TODO: This is the previous implementation. Please review.
-#        self.log.error("Unhandled protocol error: %s" % to_unicode(e))
-#        req.send_error(None, template='', content_type='text/plain',
-#                status=500, env=None, data=to_unicode(e))
-
-        stackTrace = format_exc()
         method_name = req.rpc and req.rpc.get('method') or '(undefined)'
-        body = "Unhandled protocol error calling '%s'\n\n%s" % (method_name, stackTrace)
+        body = "Unhandled protocol error calling '%s': %s" % (
+                                        method_name, to_unicode(e))
         req.send_error(None, template='', content_type='text/plain',
                             env=None, data=body, status=HTTPInternalError.code)