Created
November 27, 2012 19:17
-
-
Save marconi/4156372 to your computer and use it in GitHub Desktop.
Automount vendor apps in pecan
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# <app>.controllers.root.py | |
class BaseController(object): | |
""" | |
Base controller which main app should extend to auto mount vendor apps. | |
""" | |
def __init__(self): | |
for app, pkg in conf.vendor_apps: | |
root_controller = importlib.import_module("%s.controllers.root" % pkg) | |
setattr(self, app, root_controller.RootController()) | |
# then in config.py | |
... | |
vendor_apps = ( | |
('blog', 'vendors.blog'), | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment