bloodhound-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Apache Bloodhound" <bloodhound-...@incubator.apache.org>
Subject Re: [Apache Bloodhound] #298: Exception from missing req.chrome['labels'] in filter_stream
Date Wed, 12 Dec 2012 09:56:32 GMT
#298: Exception from missing req.chrome['labels'] in filter_stream
------------------------+-----------------------
  Reporter:  gjm        |      Owner:  gjm
      Type:  defect     |     Status:  accepted
  Priority:  major      |  Milestone:  Release 4
 Component:  dashboard  |    Version:
Resolution:             |   Keywords:
------------------------+-----------------------

Comment (by gjm):

 I believe something like this should fix:

 {{{
 #!diff
 Index: bloodhound_theme/bhtheme/theme.py
 ===================================================================
 --- bloodhound_theme/bhtheme/theme.py    (revision 1420498)
 +++ bloodhound_theme/bhtheme/theme.py    (working copy)
 @@ -123,6 +123,22 @@
      implements(IRequestFilter, INavigationContributor, ITemplateProvider,
                 ITemplateStreamFilter)

 +    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_version = ".".join(map(str,
 application_version)))
 +
      # ITemplateStreamFilter methods

      def filter_stream(self, req, method, filename, stream, data):
 @@ -155,6 +171,8 @@
              .select("body//a[contains(@href,'/wiki/%s')]" %
 wiki.GUIDE_NAME) \
              .map(lambda text: wiki.new_name(text), TEXT)

 +        req.chrome['labels'] = self._get_whitelabelling()
 +
          # Rename trac error
          app_short = req.chrome['labels']['application_short']
          tx = tx.end() \
 @@ -197,20 +215,6 @@
                  is_active = active_theme['name'] == this_theme_name
              return is_active

 -        c = self.env.config
 -        req.chrome['labels'] = 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_version = ".".join(map(str,
 application_version)))
 -
          links = req.chrome.get('links',{})
          # replace favicon if appropriate
          if self.env.project_icon == 'common/trac.ico':
 }}}

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/298#comment:2>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Mime
View raw message