Author: peter Date: Thu Dec 20 12:09:23 2012 New Revision: 1424425 URL: http://svn.apache.org/viewvc?rev=1424425&view=rev Log: Use trac.options.Option instead of env.conf.get for whitelabeling
Modified: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py Modified: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py?rev=1424425&r1=1424424&r2=1424425&view=diff ============================================================================== --- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py (original) +++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py Thu Dec 20 12:09:23 2012 @@ -20,6 +20,7 @@ from genshi.builder import tag from genshi.core import TEXT from genshi.filters.transform import Transformer +from trac.config import Option from trac.core import * from trac.mimeview.api import get_mimetype from trac.resource import Resource @@ -117,6 +118,18 @@ class BloodhoundTheme(ThemeBase): ("body//table[not(contains(@class, 'table'))]", # TODO: Accurate ? ['table', 'table-condensed']), ) + + labels_application_short = Option('labels', 'application_short', + 'Bloodhound') + + labels_application_full = Option('labels', 'application_full', + 'Apache Bloodhound') + + labels_footer_left_prefix = Option('labels', 'footer_left_prefix', '') + + labels_footer_left_postfix = Option('labels', 'footer_left_postfix', '') + + labels_footer_right = Option('labels', 'footer_right', '') _wiki_pages = None @@ -125,18 +138,12 @@ class BloodhoundTheme(ThemeBase): def _get_whitelabelling(self): """Gets the whitelabelling config values""" - c = self.env.config return dict( - application_short = c.get( - 'labels', 'application_short', "Bloodhound"), - application_full = c.get( - 'labels', 'application_full', "Apache Bloodhound"), - footer_left_prefix = c.get( - 'labels', 'footer_left_prefix', ""), - footer_left_postfix = c.get( - 'labels', 'footer_left_postfix', ""), - footer_right = c.get( - 'labels', 'footer_right', ""), + application_short = self.labels_application_short, + application_full = self.labels_application_full, + footer_left_prefix = self.labels_footer_left_prefix, + footer_left_postfix = self.labels_footer_left_postfix, + footer_right = self.labels_footer_right, application_version = ".".join(map(str, application_version))) # ITemplateStreamFilter methods @@ -172,7 +179,7 @@ class BloodhoundTheme(ThemeBase): .map(lambda text: wiki.new_name(text), TEXT) # Rename trac error - app_short = self._get_whitelabelling()['application_short'] + app_short = self.labels_application_short tx = tx.end() \ .select("body//div[@class='error']/h1") \ .map(lambda text: text.replace("Trac", app_short), TEXT)