Commit 01783ea5e50a6c0b951eca132ab06f3cb1cacf0c

Authored by Gust
1 parent 750f790e

Update plugin configuration

Signed-off-by: Gustavo Jaruga <darksshades@gmail.com>
Signed-off-by: Alexandre Barbosa <alexandreab@live.com>
colab/management/initconfig.py
... ... @@ -69,6 +69,13 @@ ROBOTS_NOINDEX: false
69 69 ### Log errors to Sentry instance
70 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 79 ### Colab proxied apps
73 80 # COLAB_APPS:
74 81 # colab.proxy.gitlab:
... ... @@ -76,44 +83,40 @@ ROBOTS_NOINDEX: false
76 83 # menu:
77 84 # title: 'Code'
78 85 # links:
79   -# { 'Public Projects' : '/gitlab/public/projects' }
  86 +# Public Projects: '/gitlab/public/projects'
80 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 94 # dpaste:
88 95 # urls:
89 96 # include: 'dpaste.urls.dpaste'
90 97 # prefix: '^paste/'
91 98 # namespace: 'dpaste'
92   -# templates:
93   -# templatesdir: '/vagrant/pluginfiles/dpaste/templates'
94   -# staticdir: '/vagrant/pluginfiles/dpaste/static'
95 99 # menu:
96 100 # title: 'Dpaste'
97 101 # links:
98   -# { 'Public Projects': '/paste' }
  102 +# Public Projects: '/paste'
99 103 # auth_links:
100   -# { 'Profile': '/projects',
101   -# 'New Project': '/projects/new' }
  104 +# Profile: '/projects'
  105 +# New Project: '/projects/new'
102 106 # feedzilla:
103   -# dependencies: ['common']
  107 +# dependencies:
  108 +# - 'common'
104 109 # urls:
105 110 # include: 'feedzilla.urls'
106 111 # prefix: '^planet/'
107 112 # namespace: 'planet'
108 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 116 # menu:
114 117 # title: 'Planet'
115 118 # links:
116   -# { 'Index' : '/planet' }
  119 +# Index: '/planet'
117 120 # auth_links:
118 121 # {}
119 122  
... ...
colab/settings.py
... ... @@ -307,26 +307,19 @@ for app_name, app in COLAB_APPS.items():
307 307 if app.get('upstream'):
308 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 315 if 'context_processors' in app:
316 316 for context_processor in app.get('context_processors'):
317 317 if context_processor not in TEMPLATE_CONTEXT_PROCESSORS:
318 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 56  
57 57 Declares the namespace for the url.
58 58  
59   -templates
  59 +context_processors
60 60 ++++++++++++
61 61  
62   -.. attribute:: context_processors
63   -
64 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 68 Settings
76 69 --------
... ...