Skip to content
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

how to create a module-based API #31

Open
faassen opened this issue May 18, 2016 · 0 comments
Open

how to create a module-based API #31

faassen opened this issue May 18, 2016 · 0 comments

Comments

@faassen
Copy link
Member

faassen commented May 18, 2016

Dectate is written around app class driven APIs such as used in Morepath. This gives you special features like inheritance and overrides. But what if you want to give a decorator-based API to something that already exists? If there is no clear "registry" concept you can associate with an app class those features of Dectate are not useful anyway. You can still use Dectate for the directive ordering and conflict detection and so on.

You can in this case expose a module API like this:

class HiddenApp(dectate.App):
    pass

some_directive = HiddenApp.some_directive
commit = HiddenApp.commit

We should document this and ideally offer some automation so that this is done by itself. Or would it be enough to simply expose HiddenApp as a pretend module you can use?

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

No branches or pull requests

1 participant