Try logging args/kwargs in your wrapper:
+ print(args)
+ print(kwargs)
kwargs = dict(zip(keys,args))
But I have another question now: why do you need _cp_dispatch there? What's your end-goal? It seems like you're just looking to reimplement the default method with a regular URI traversal based dispatcher.
I've made a small demo for you. Is this what you're looking for?
$ cat cp_default_handler_demo.py
#! /usr/bin/env python
"""Demo of how to use the ``default`` handler method."""
import cherrypy
class HelloWorld:
"""Collection of traversed URL handlers."""
@cherrypy.expose
def index(self, **params): # pylint: disable=no-self-use
"""Root URI HTTP handler."""
return f'Hello from index, see params: {params}'
@cherrypy.expose
def foo(self, **params): # pylint: disable=no-self-use
"""Foo URI HTTP handler."""
return f"""
Hello from foo, see params: {params};<br>
cp params: {cherrypy.request.params}
"""
@cherrypy.expose
# pylint: disable=no-self-use
def default(self, one, two=None, three=None, **params):
"""Default URI HTTP handler."""
return f"""
Hello from default, see params: {params};<br>
cp params: {cherrypy.request.params}<br>
one={one}; two={two}; three={three}
"""
cherrypy.config.update({
'server.socket_port': 33333,
})
# pylint: disable=expression-not-assigned
__name__ == '__main__' and cherrypy.quickstart(HelloWorld(), '/', {})
$ ./cp_default_handler_demo.py
[28/Jul/2019:22:30:05] ENGINE Listening for SIGTERM.
[28/Jul/2019:22:30:05] ENGINE Listening for SIGHUP.
[28/Jul/2019:22:30:05] ENGINE Listening for SIGUSR1.
[28/Jul/2019:22:30:05] ENGINE Bus STARTING
CherryPy Checker:
The Application mounted at '' has an empty config.
[28/Jul/2019:22:30:05] ENGINE Started monitor thread 'Autoreloader'.
[28/Jul/2019:22:30:05] ENGINE Serving on http://127.0.0.1:33333
[28/Jul/2019:22:30:05] ENGINE Bus STARTED
127.0.0.1 - - [28/Jul/2019:22:30:13] "GET / HTTP/1.1" 200 32 "" "curl/7.65.1"
127.0.0.1 - - [28/Jul/2019:22:30:20] "GET / HTTP/1.1" 200 32 "" "curl/7.65.1"
127.0.0.1 - - [28/Jul/2019:22:30:29] "GET /?x=y HTTP/1.1" 200 40 "" "curl/7.65.1"
127.0.0.1 - - [28/Jul/2019:22:30:40] "GET /foo HTTP/1.1" 200 83 "" "curl/7.65.1"
127.0.0.1 - - [28/Jul/2019:22:30:44] "GET /foo?x=y HTTP/1.1" 200 99 "" "curl/7.65.1"
127.0.0.1 - - [28/Jul/2019:22:31:20] "GET /o/t/tt?hoho=wow HTTP/1.1" 200 152 "" "curl/7.65.1"
^C[28/Jul/2019:22:31:32] ENGINE Keyboard Interrupt: shutting down bus
[28/Jul/2019:22:31:32] ENGINE Bus STOPPING
[28/Jul/2019:22:31:32] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('127.0.0.1', 33333)) shut down
[28/Jul/2019:22:31:32] ENGINE Stopped thread 'Autoreloader'.
[28/Jul/2019:22:31:32] ENGINE Bus STOPPED
[28/Jul/2019:22:31:32] ENGINE Bus EXITING
[28/Jul/2019:22:31:32] ENGINE Bus EXITED
[28/Jul/2019:22:31:32] ENGINE Waiting for child threads to terminate...