Dans l'exemple suivant, je m'attend à obtenir une exception lors de l'accès à l'URL http://127.0.0.1:8080/b/method_b. Au lieu de cela, j'obtiens une réponse http normale contenant le texte 'method_b' dans le navigateur. Aucune exception n'a été déclenchée, ce qui signifie que _cp_dispatcher n'est pas appelé. Est-ce que je me trompe sur _cp_dispatch? J'utilise la version 3.8.0 cherrypy en python 2.7.10_cp_dispatch ne pas être appelé dans cherrypy
import cherrypy
class B(object):
def _cp_dispatch(self, vpath):
raise Exception("Here!!")
@cherrypy.expose
def method_b(self):
return "method_b"
class A(object):
def __init__(self):
self.b = B()
cherrypy.quickstart(A())
En effet, j'ai testé cela. Demander/b/garbage déclenche l'exception. Merci de votre aide. – collier