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

Changeset 1172

Show
Ignore:
Timestamp:
06/28/06 21:28:45
Author:
dowski
Message:

Fix for #533. CP3 will behave correctly and return a Fault when an XML-RPC method is not found.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/_cptools.py

    r1171 r1172  
    204204        for attr in str(rpcmethod).split('.'): 
    205205            subhandler = getattr(subhandler, attr, None) 
    206             if subhandler is None: 
    207                 raise cherrypy.NotFound() 
    208         if not getattr(subhandler, "exposed", False): 
    209             raise cherrypy.NotFound() 
    210          
    211         body = subhandler(*(vpath + rpcparams), **params) 
     206          
     207        if subhandler and getattr(subhandler, "exposed", False): 
     208            body = subhandler(*(vpath + rpcparams), **params) 
     209 
     210        else: 
     211            # http://www.cherrypy.org/ticket/533 
     212            # if a method is not found, an xmlrpclib.Fault should be returned 
     213            # raising an exception here will do that; see 
     214            # cherrypy.lib.xmlrpc.on_error 
     215            raise Exception, 'method "%s" is not supported' % attr 
     216             
    212217        conf = cherrypy.request.toolmap.get("xmlrpc", {}) 
    213218        _xmlrpc.respond(body, 
  • trunk/cherrypy/test/test_xmlrpc.py

    r1134 r1172  
    100100            self.fail("Expected xmlrpclib.Fault") 
    101101 
     102        # http://www.cherrypy.org/ticket/533 
     103        # if a method is not found, an xmlrpclib.Fault should be raised 
     104        try: 
     105            proxy.non_method() 
     106        except Exception, x: 
     107            self.assertEqual(x.__class__, xmlrpclib.Fault) 
     108            self.assertEqual(x.faultString, 'method "non_method" is not supported') 
     109        else: 
     110            self.fail("Expected xmlrpclib.Fault") 
     111 
    102112 
    103113if __name__ == '__main__': 

Hosted by WebFaction

Log in as guest/cpguest to create tickets