diff --git a/colab/management/initconfig.py b/colab/management/initconfig.py index 7ffeca8..61a7269 100644 --- a/colab/management/initconfig.py +++ b/colab/management/initconfig.py @@ -69,6 +69,13 @@ ROBOTS_NOINDEX: false ### Log errors to Sentry instance # RAVEN_DSN: 'http://public:secret@example.com/1' +COLAB_TEMPLATES: + +COLAB_STATICS: + +# FEEDZILLA_SITE_TITLE: 'Planet Colab' +# FEEDZILLA_SITE_DESCRIPTION: 'Colab blog aggregator' + ### Colab proxied apps # COLAB_APPS: # colab.proxy.gitlab: @@ -76,44 +83,40 @@ ROBOTS_NOINDEX: false # menu: # title: 'Code' # links: -# { 'Public Projects' : '/gitlab/public/projects' } +# Public Projects: '/gitlab/public/projects' # auth_links: -# { 'Profile' : 'gitlab/profile', -# 'New Project' : 'gitlab/projects/new', -# 'Projects' : 'gitlab/dashboard/projects', -# 'Groups' : 'gitlab/pprofile/groups', -# 'Issues' : 'gitlab/dashboard/issues', -# 'Merge Requests' : 'gitlab/merge_requests' } +# Profile: 'gitlab/profile' +# New Project: 'gitlab/projects/new' +# Projects: 'gitlab/dashboard/projects' +# Groups: 'gitlab/pprofile/groups' +# Issues: 'gitlab/dashboard/issues' +# Merge Requests: 'gitlab/merge_requests' # dpaste: # urls: # include: 'dpaste.urls.dpaste' # prefix: '^paste/' # namespace: 'dpaste' -# templates: -# templatesdir: '/vagrant/pluginfiles/dpaste/templates' -# staticdir: '/vagrant/pluginfiles/dpaste/static' # menu: # title: 'Dpaste' # links: -# { 'Public Projects': '/paste' } +# Public Projects: '/paste' # auth_links: -# { 'Profile': '/projects', -# 'New Project': '/projects/new' } +# Profile: '/projects' +# New Project: '/projects/new' # feedzilla: -# dependencies: ['common'] +# dependencies: +# - 'common' # urls: # include: 'feedzilla.urls' # prefix: '^planet/' # namespace: 'planet' # templates: -# context_processors: ['colab.planet.context_processors.feedzilla'] -# templatesdir: '/vagrant/pluginfiles/feedzilla/templates' -# staticdir: '/vagrant/pluginfiles/feedzilla/static' -# localesdir: '/vagrant/pluginfiles/feedzilla/locales' +# context_processors: +# - 'colab.planet.context_processors.feedzilla' # menu: # title: 'Planet' # links: -# { 'Index' : '/planet' } +# Index: '/planet' # auth_links: # {} diff --git a/colab/settings.py b/colab/settings.py index 7f0ee33..19d7e7f 100644 --- a/colab/settings.py +++ b/colab/settings.py @@ -307,26 +307,19 @@ for app_name, app in COLAB_APPS.items(): if app.get('upstream'): PROXIED_APPS[app_name.split('.')[-1]] = app - if not app or 'templates' not in app: - continue - - template = app.get('templates') + if 'middlewares' in app: + for middleware in app.get('middlewares'): + if middleware not in MIDDLEWARE_CLASSES: + MIDDLEWARE_CLASSES += (middleware,) if 'context_processors' in app: for context_processor in app.get('context_processors'): if context_processor not in TEMPLATE_CONTEXT_PROCESSORS: TEMPLATE_CONTEXT_PROCESSORS += (context_processor,) - if template.get('staticdir'): - STATICFILES_DIRS += (template.get('staticdir'),) - if template.get('templatesdir'): - TEMPLATE_DIRS += (template.get('templatesdir'),) - if template.get('localesdir'): - LOCALE_PATHS += (template.get('localesdir'),) - -import sys -sys.path.insert(0, '/etc/colab/') -try: - from plugin_configs import * # noqa (flake8 ignore) -except ImportError: - pass +colab_templates = locals().get('COLAB_TEMPLATES') or {} +colab_statics = locals().get('COLAB_STATICS') or {} + +TEMPLATE_DIRS += tuple(colab_templates) +STATICFILES_DIRS += tuple(colab_statics) + diff --git a/docs/source/user.rst b/docs/source/user.rst index 32065df..2dee8b0 100644 --- a/docs/source/user.rst +++ b/docs/source/user.rst @@ -56,21 +56,14 @@ urls Declares the namespace for the url. -templates +context_processors ++++++++++++ -.. attribute:: context_processors - Declares the plugin context processors. -.. attribute:: templatesdir - - Declares the path to templates directory. -.. attribute:: staticdir - Declares the path to static directory. -.. attribute:: localesdir - - Declares the path to locales directory. +middlewares +++++++++++++ + Declares the plugin middlewares. Settings -------- -- libgit2 0.21.2