On Jun 28, 2012, at 5:18 AM, Anthony wrote:
> A controller-name map (or perhaps some generalization of that concept) would
> be relatively straightforward in the parametric router. Not sure how
> generally useful it'd be.
>
> Something like that would be particularly useful when using plugins, as you
> usually do not want "plugin_" in your URLs (and may generally not like the
> name the plugin author chose for the plugin).
>
I was thinking something like: you'd specify a list of duples. Each duple would
carry the external and internal controller name, thus:
route_map = [ ('prettyname', 'plugin_ugly'), ],
We could allow function names in the map:
route_map = [ ('prettyname/prettyfunc', 'plugin_ugly/uglyfunc'), ],
(it would be an error to have a function in only half of a duple)
The tricky part: by default, we have controllers = 'DEFAULT', which gets the
list of valid controllers from the file system, which is to say (in terms of
the map) the internal controller names. But we need to do incoming routing
first, and then apply the mapping (otherwise we haven't yet figured out the
intended a/c/f). To do the incoming routing we need the list of external
controller names.
Moreover, I figure that we also want to accept incoming URLs that use the
internal names, following the principle (in the parametric router, at least)
that a fully specified URL that works with routing disabled should also work
with routing enabled.
So I'm thinking: all controller names mentioned in the map are implicitly added
to the controllers= list.
There might be some other difficulties. Not sure.