New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify extensions/plugins/hooks/etc #129

Closed
derks opened this Issue Jul 6, 2012 · 0 comments

Comments

Projects
None yet
1 participant
@derks
Member

derks commented Jul 6, 2012

Currently, to maintain a large application of extensions/plugins you generally need a 'bootstrap' file that registers handlers/etc, and then keep your actually libraries externally. Cement does this in namespace packages for 'ext' and 'lib'... but it gets messy.

Would like to consider adding a requirement for a 'load()' function in an extension/plugin modules. This way you can import classes/etc from the module... without actually registering/loading the extension/plugin. Something like:

from cement.core import handler, hook

def my_post_setup_hook(app):
    pass

class MyHandler(handler.CementHandler):
    pass

def load(app):
    handler.register(MyHadler)
    hook.register('post_setup', my_post_setup_hook)

This way, I can still import MyHandler from the module if, for example, I want to sub-class it. But nothing is loaded. Can then move all decorators to 'cement.core.decorators' (maybe).

@ghost ghost assigned derks Jul 6, 2012

derks pushed a commit that referenced this issue Jul 13, 2012

@derks derks closed this Jul 13, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment