From 042c86e52089ddc92ff862ccbb22fd48f0dbd947 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Mon, 27 May 2013 15:39:21 +0200 Subject: [PATCH] publisher: add support for a [variables] section (#2957) --- wcs/qommon/publisher.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/wcs/qommon/publisher.py b/wcs/qommon/publisher.py index a4f4988..650b293 100644 --- a/wcs/qommon/publisher.py +++ b/wcs/qommon/publisher.py @@ -837,7 +837,7 @@ class QommonPublisher(Publisher): def get_substitution_variables(self): import misc - return { + d = { 'site_name': get_cfg('misc', {}).get('sitename', None), 'site_theme': get_cfg('branding', {}).get('theme', self.default_theme), 'site_url': self.get_frontoffice_url(), @@ -846,6 +846,13 @@ class QommonPublisher(Publisher): 'today': strftime.strftime(misc.date_format(), time.localtime()), 'now': misc.localstrftime(time.localtime()), } + if self.site_options is None: + self.load_site_options() + try: + d.update(dict(self.site_options.items('variables'))) + except ConfigParser.NoSectionError: + pass + return d extra_sources = [] def register_extra_source(cls, source): -- 1.7.10.4