Issue #363 resolved

Request-URI of * needs better API

Robert Brewer
created an issue

Changeset [523] introduced a way to map a Request-URI of "*" (no resource) to {{{cherrypy.root._global}}}. See for the rare case where anyone would send such a request.

{{{cherrypy.root._global}}} isn't the best solution for two reasons:

  1. The name is wrong. It shouldn't be {{{_global}}}, but {{{global}}} or {{{global}}} or something else instead. The leading-single-underscore is the wrong semantic (there's no reason it should be a loosely-private name). It was chosen too quickly, in order to minimize collisions with user code.
  2. The slot is wrong. It shouldn't be under cherrypy.root. Instead, it should be under cherrypy or even cherrypy.server. Possible names would be {{{cherrypy.no_resource()}}} or {{{}}}. You might think (as I did when I made the change) that cherrypy.root is the more correct place for this, since cherrypy.root is where even a Request-URI of "/" is mapped. However, we should, in the future, move to arbitrary mount points for applications (where cherrypy.root.index actually maps to a URI like /my/corner/of/this/website/blog/). When we do, it won't work to map "" to cherrypy.root, since we will potentially have multiple such root objects; the "" URI cannot be subject to a mount point like "/" can be.

Comments (2)

  1. Log in to comment