derks/cement — Issue #69: Optionally register loaded extension handlers
Author: derks
Created: 2011-10-27 00:03:08+00:00
State: open

Currently extensions are expected to call 'handler.register' to register any handlers when being loaded (as an extension). This is annoying when say, you just want to import a class in order to subclass from it.

I would like to add an additional requirement to extensions that they must have a '__CEMENT_HANDLERS__' list. Handlers listed here will be auto-registered by cement when loading the module as an extension. For example:

__CEMENT_HANDLERS__ = ['MyHandler', 'MyHandler2']

class MyHandler(object):
....

class MyHandler(object):
....

This way, the module no longer needs to call 'handler.register(MyHandler)' ... as cement will do that automatically.