Yesterday I posted about implementing dynamic actions (functions) in a
controller.
This is interesting because one can achieve clean urls, instead of passing
the names of the dynamic pages in args or vars. In a system with a cms this
has the benefit of user defined pages being indistinguishable from extant
"hard-coded" actions (if any).

However, given the static nature of controllers (they are compiled with
web2py) this cannot be achieved with closures or metaprogramming. The
solution is to use routes to hide a dispatching action. It maybe possible to
add to the controller namespace at runtime (but it is beyond my knowledge to
explore this).

This made me think that controllers might allow for the implementation
(override?) a single dynamic action that would serve as a catchall for calls
to non defined actions. I wonder if there as been any debate on this sort of
built-in default action? This would supply a way to dealt with all calls
that have no defined action per controller (including errors) without having
to use routes. A small idea that perhaps does not bring enough benefits to
be argued for. What do you think?

Miguel

Reply via email to