Changes between Version 2 and Version 3 of Ticket #11799, comment 2


Ignore:
Timestamp:
Oct 7, 2016, 9:35:57 PM (8 years ago)
Author:
Jun Omae
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #11799, comment 2

    v2 v3  
    1 {{{#!diff
    2 diff --git a/tracrpc/web_ui.py b/tracrpc/web_ui.py
    3 index d738e87..3fd77d6 100644
    4 --- a/tracrpc/web_ui.py
    5 +++ b/tracrpc/web_ui.py
    6 @@ -29,7 +29,7 @@ from trac.wiki.formatter import wiki_to_oneliner
    7 
    8  from tracrpc.api import XMLRPCSystem, IRPCProtocol, ProtocolException, \
    9                            RPCError, ServiceException
    10 -from tracrpc.util import accepts_mimetype
    11 +from tracrpc.util import accepts_mimetype, exception_to_unicode
    12 
    13  __all__ = ['RPCWeb']
    14 
    15 @@ -158,7 +158,7 @@ class RPCWeb(Component):
    16                  result = (XMLRPCSystem(self.env).get_method(method_name)(req, args))[0]
    17                  if isinstance(result, GeneratorType):
    18                      result = list(result)
    19 -            except (RPCError, PermissionError, ResourceNotFound), e:
    20 +            except (TracError, PermissionError, ResourceNotFound), e:
    21                  raise
    22              except Exception:
    23                  e, tb = sys.exc_info()[-2:]
    24 @@ -167,8 +167,9 @@ class RPCWeb(Component):
    25                  protocol.send_rpc_result(req, result)
    26          except RequestDone :
    27              raise
    28 -        except (RPCError, PermissionError, ResourceNotFound), e:
    29 -            self.log.exception("RPC(%s) Error", proto_id)
    30 +        except (TracError, PermissionError, ResourceNotFound), e:
    31 +            self.log.warning("RPC(%s) [%s] %s", proto_id, req.remote_addr,
    32 +                             exception_to_unicode(e))
    33              try :
    34                  protocol.send_rpc_error(req, e)
    35              except RequestDone :
    36 }}}
     1Proposed changes in https://github.com/jun66j5/xmlrpcplugin/commit/t11799.
    372
    383After the patch:
    394{{{
    40 2016-10-07 19:28:11,665 Trac[web_ui] WARNING: RPC(JSON-RPC) [192.168.11.27] PermissionError: XML_RPC privileges are required to perform this operation. You don't have the required permissions.
     506:33:44 AM Trac[web_ui] WARNING: RPC(JSON-RPC) [192.168.11.27] PermissionError: XML_RPC privileges are required to perform this operation. You don't have the required permissions.
     606:34:39 AM Trac[web_ui] ERROR: RPC(JSON-RPC) [192.168.11.27] Exception caught while calling ticket.get(*[u'a']) by admin
     7Traceback (most recent call last):
     8  File "/src/xmlrpcplugin.git/tracrpc/web_ui.py", line 158, in _rpc_process
     9    result = (XMLRPCSystem(self.env).get_method(method_name)(req, args))[0]
     10  File "/src/xmlrpcplugin.git/tracrpc/api.py", line 197, in __call__
     11    result = self.callable(req, *args)
     12  File "/src/xmlrpcplugin.git/tracrpc/ticket.py", line 154, in get
     13    t = model.Ticket(self.env, id)
     14  File "/venv/trac/py27/1.0.13/local/lib/python2.7/site-packages/trac/ticket/model.py", line 69, in __init__
     15    tkt_id = int(tkt_id)
     16ValueError: invalid literal for int() with base 10: 'a'
    4117}}}