Issue #1045 resolved

CherryPy should support uninstantiated classes as controllers, and instantiate them on dispatching

Anonymous created an issue

Currently, cherrypy only supports instances as controllers, but classes are interesting as overriding {{{new}}} allows for factory-method-usage, such as [http://www.cocoadev.com/index.pl?ClassClusters class clusters].

In my case, one of the applications I work on is pluggable and one of the plugin points is the predefined controllers, which can be overridden in-place. With class controllers I could simply search for the extension point at instantiation time and return the correct instance (of some subclass of the original controller), but I currently have to go through a few indirections to achieve this goal instead.

As far as I can see, adding this behavior is just a 2-lines patch (see provided)

Reported by Masklinn

Comments (2)

  1. Log in to comment