Commit 01783ea5e50a6c0b951eca132ab06f3cb1cacf0c
1 parent
750f790e
Exists in
master
and in
34 other branches
Update plugin configuration
Signed-off-by: Gustavo Jaruga <darksshades@gmail.com> Signed-off-by: Alexandre Barbosa <alexandreab@live.com>
Showing
3 changed files
with
36 additions
and
47 deletions
Show diff stats
colab/management/initconfig.py
@@ -69,6 +69,13 @@ ROBOTS_NOINDEX: false | @@ -69,6 +69,13 @@ ROBOTS_NOINDEX: false | ||
69 | ### Log errors to Sentry instance | 69 | ### Log errors to Sentry instance |
70 | # RAVEN_DSN: 'http://public:secret@example.com/1' | 70 | # RAVEN_DSN: 'http://public:secret@example.com/1' |
71 | 71 | ||
72 | +COLAB_TEMPLATES: | ||
73 | + | ||
74 | +COLAB_STATICS: | ||
75 | + | ||
76 | +# FEEDZILLA_SITE_TITLE: 'Planet Colab' | ||
77 | +# FEEDZILLA_SITE_DESCRIPTION: 'Colab blog aggregator' | ||
78 | + | ||
72 | ### Colab proxied apps | 79 | ### Colab proxied apps |
73 | # COLAB_APPS: | 80 | # COLAB_APPS: |
74 | # colab.proxy.gitlab: | 81 | # colab.proxy.gitlab: |
@@ -76,44 +83,40 @@ ROBOTS_NOINDEX: false | @@ -76,44 +83,40 @@ ROBOTS_NOINDEX: false | ||
76 | # menu: | 83 | # menu: |
77 | # title: 'Code' | 84 | # title: 'Code' |
78 | # links: | 85 | # links: |
79 | -# { 'Public Projects' : '/gitlab/public/projects' } | 86 | +# Public Projects: '/gitlab/public/projects' |
80 | # auth_links: | 87 | # auth_links: |
81 | -# { 'Profile' : 'gitlab/profile', | ||
82 | -# 'New Project' : 'gitlab/projects/new', | ||
83 | -# 'Projects' : 'gitlab/dashboard/projects', | ||
84 | -# 'Groups' : 'gitlab/pprofile/groups', | ||
85 | -# 'Issues' : 'gitlab/dashboard/issues', | ||
86 | -# 'Merge Requests' : 'gitlab/merge_requests' } | 88 | +# Profile: 'gitlab/profile' |
89 | +# New Project: 'gitlab/projects/new' | ||
90 | +# Projects: 'gitlab/dashboard/projects' | ||
91 | +# Groups: 'gitlab/pprofile/groups' | ||
92 | +# Issues: 'gitlab/dashboard/issues' | ||
93 | +# Merge Requests: 'gitlab/merge_requests' | ||
87 | # dpaste: | 94 | # dpaste: |
88 | # urls: | 95 | # urls: |
89 | # include: 'dpaste.urls.dpaste' | 96 | # include: 'dpaste.urls.dpaste' |
90 | # prefix: '^paste/' | 97 | # prefix: '^paste/' |
91 | # namespace: 'dpaste' | 98 | # namespace: 'dpaste' |
92 | -# templates: | ||
93 | -# templatesdir: '/vagrant/pluginfiles/dpaste/templates' | ||
94 | -# staticdir: '/vagrant/pluginfiles/dpaste/static' | ||
95 | # menu: | 99 | # menu: |
96 | # title: 'Dpaste' | 100 | # title: 'Dpaste' |
97 | # links: | 101 | # links: |
98 | -# { 'Public Projects': '/paste' } | 102 | +# Public Projects: '/paste' |
99 | # auth_links: | 103 | # auth_links: |
100 | -# { 'Profile': '/projects', | ||
101 | -# 'New Project': '/projects/new' } | 104 | +# Profile: '/projects' |
105 | +# New Project: '/projects/new' | ||
102 | # feedzilla: | 106 | # feedzilla: |
103 | -# dependencies: ['common'] | 107 | +# dependencies: |
108 | +# - 'common' | ||
104 | # urls: | 109 | # urls: |
105 | # include: 'feedzilla.urls' | 110 | # include: 'feedzilla.urls' |
106 | # prefix: '^planet/' | 111 | # prefix: '^planet/' |
107 | # namespace: 'planet' | 112 | # namespace: 'planet' |
108 | # templates: | 113 | # templates: |
109 | -# context_processors: ['colab.planet.context_processors.feedzilla'] | ||
110 | -# templatesdir: '/vagrant/pluginfiles/feedzilla/templates' | ||
111 | -# staticdir: '/vagrant/pluginfiles/feedzilla/static' | ||
112 | -# localesdir: '/vagrant/pluginfiles/feedzilla/locales' | 114 | +# context_processors: |
115 | +# - 'colab.planet.context_processors.feedzilla' | ||
113 | # menu: | 116 | # menu: |
114 | # title: 'Planet' | 117 | # title: 'Planet' |
115 | # links: | 118 | # links: |
116 | -# { 'Index' : '/planet' } | 119 | +# Index: '/planet' |
117 | # auth_links: | 120 | # auth_links: |
118 | # {} | 121 | # {} |
119 | 122 |
colab/settings.py
@@ -307,26 +307,19 @@ for app_name, app in COLAB_APPS.items(): | @@ -307,26 +307,19 @@ for app_name, app in COLAB_APPS.items(): | ||
307 | if app.get('upstream'): | 307 | if app.get('upstream'): |
308 | PROXIED_APPS[app_name.split('.')[-1]] = app | 308 | PROXIED_APPS[app_name.split('.')[-1]] = app |
309 | 309 | ||
310 | - if not app or 'templates' not in app: | ||
311 | - continue | ||
312 | - | ||
313 | - template = app.get('templates') | 310 | + if 'middlewares' in app: |
311 | + for middleware in app.get('middlewares'): | ||
312 | + if middleware not in MIDDLEWARE_CLASSES: | ||
313 | + MIDDLEWARE_CLASSES += (middleware,) | ||
314 | 314 | ||
315 | if 'context_processors' in app: | 315 | if 'context_processors' in app: |
316 | for context_processor in app.get('context_processors'): | 316 | for context_processor in app.get('context_processors'): |
317 | if context_processor not in TEMPLATE_CONTEXT_PROCESSORS: | 317 | if context_processor not in TEMPLATE_CONTEXT_PROCESSORS: |
318 | TEMPLATE_CONTEXT_PROCESSORS += (context_processor,) | 318 | TEMPLATE_CONTEXT_PROCESSORS += (context_processor,) |
319 | 319 | ||
320 | - if template.get('staticdir'): | ||
321 | - STATICFILES_DIRS += (template.get('staticdir'),) | ||
322 | - if template.get('templatesdir'): | ||
323 | - TEMPLATE_DIRS += (template.get('templatesdir'),) | ||
324 | - if template.get('localesdir'): | ||
325 | - LOCALE_PATHS += (template.get('localesdir'),) | ||
326 | - | ||
327 | -import sys | ||
328 | -sys.path.insert(0, '/etc/colab/') | ||
329 | -try: | ||
330 | - from plugin_configs import * # noqa (flake8 ignore) | ||
331 | -except ImportError: | ||
332 | - pass | 320 | +colab_templates = locals().get('COLAB_TEMPLATES') or {} |
321 | +colab_statics = locals().get('COLAB_STATICS') or {} | ||
322 | + | ||
323 | +TEMPLATE_DIRS += tuple(colab_templates) | ||
324 | +STATICFILES_DIRS += tuple(colab_statics) | ||
325 | + |
docs/source/user.rst
@@ -56,21 +56,14 @@ urls | @@ -56,21 +56,14 @@ urls | ||
56 | 56 | ||
57 | Declares the namespace for the url. | 57 | Declares the namespace for the url. |
58 | 58 | ||
59 | -templates | 59 | +context_processors |
60 | ++++++++++++ | 60 | ++++++++++++ |
61 | 61 | ||
62 | -.. attribute:: context_processors | ||
63 | - | ||
64 | Declares the plugin context processors. | 62 | Declares the plugin context processors. |
65 | -.. attribute:: templatesdir | ||
66 | - | ||
67 | - Declares the path to templates directory. | ||
68 | -.. attribute:: staticdir | ||
69 | 63 | ||
70 | - Declares the path to static directory. | ||
71 | -.. attribute:: localesdir | ||
72 | - | ||
73 | - Declares the path to locales directory. | 64 | +middlewares |
65 | +++++++++++++ | ||
66 | + Declares the plugin middlewares. | ||
74 | 67 | ||
75 | Settings | 68 | Settings |
76 | -------- | 69 | -------- |