Changeset 18643


Ignore:
Timestamp:
Jun 7, 2024, 3:38:52 PM (10 months ago)
Author:
Jun Omae
Message:

XmlRpcPlugin: add __str__ method to _CompositeRpcError for Python 3

Location:
xmlrpcplugin/trunk/tracrpc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • xmlrpcplugin/trunk/tracrpc/api.py

    r18513 r18643  
    5050        RPCError.__init__(self, message, title, show_traceback)
    5151
    52     def __unicode__(self):
    53         return u"%s details : %s" % (self.__class__.__name__, self.message)
     52    def _to_u(self):
     53        return u"%s details: %s" % (self.__class__.__name__, self.message)
     54
     55    if unicode is str:
     56        __str__ = _to_u
     57    else:
     58        __unicode__ = _to_u
     59        __str__ = lambda self: unicode(self).encode('utf-8')
    5460
    5561
  • xmlrpcplugin/trunk/tracrpc/tests/json_rpc.py

    r18518 r18643  
    350350        self.assertEqual(result['error']['code'], -32700)
    351351        self.assertEqual(result['error']['name'], 'JSONRPCError')
    352         self.assertIn('No JSON object could be decoded',
    353                       result['error']['message'])
     352        self.assertIn('JsonProtocolException details: No JSON object could be '
     353                      'decoded', result['error']['message'])
    354354
    355355    def test_not_a_dict(self):
Note: See TracChangeset for help on using the changeset viewer.