Skip to content

Instantly share code, notes, and snippets.

@marconi
Created November 27, 2012 19:17
Show Gist options
  • Save marconi/4156372 to your computer and use it in GitHub Desktop.
Save marconi/4156372 to your computer and use it in GitHub Desktop.
Automount vendor apps in pecan
# <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