Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Ticket #791 (defect)

Opened 3 months ago

Last modified 3 weeks ago

cherrypy.lib.xmlrpc.respond cannot marshal xmlrpclib.Fault objects

Status: closed (fixed)

Reported by: callan@blackcat.ca Assigned to: rdelon
Priority: normal Milestone:
Component: CherryPy code Keywords:
Cc:

When using xmlrpclib.dumps it is perfectly legal and accepted to pass in an xmlrpclib.Fault instance to signify an application error. Currently, cherrypy.lib.xmlrpc.respond wraps all body content inside a tuple causing the underlying xmlrpclib.dumps function to be unable to marshal xmlrpclib.Fault objects.

The current code:

def respond(body, encoding='utf-8', allow_none=0):
    import xmlrpclib
    _set_response(xmlrpclib.dumps((body,), methodresponse=1,
                                  encoding=encoding,
                                  allow_none=allow_none))

Really should be replaced with something like:

def respond(body, encoding='utf-8', allow_none=0):
    if not isinstance(body, xmlrpclib.Fault):
        body = (body,)
    _set_response(xmlrpclib.dumps(body, methodresponse=1,
                                  encoding=encoding,
                                  allow_none=allow_none))

Change History

04/26/08 20:20:07: Modified by fumanchu

  • status changed from new to closed.
  • resolution set to fixed.

Fixed in [1955].

Hosted by WebFaction

Log in as guest/cpguest to create tickets