#330: Lazy evaluation of req.chrome
--------------------------+--------------------
Reporter: peter | Owner: nobody
Type: enhancement | Status: closed
Priority: minor | Milestone:
Component: dashboard | Version:
Resolution: fixed | Keywords:
--------------------------+--------------------
Comment (by andrej):
I can see the similar behavior when rendering an error page on local env
(rev 1439061). The error occurs when an exception is trigged during
request dispatching by handler. For example, use built-in search and set
page parameter that is out of range e.g.
http://localhost:8000/main/search?q=test&page=100
You've got a plain text error page indicating that there is an error in
{{{
... bloodhound_theme.html", line 278, in <Expression
u'chrome.labels.footer_left_prefix'>
...
has no member named "labels"
}}}
As far as I understand the code, the problem is in
bloodhound_theme/bhtheme/theme.py, line 217
{{{
def post_process_request(self, req, template, data, content_type):
"""Post process request filter.
Removes all trac provided css if required"""
if template is None and data is None:
return template, data, content_type
...
req.chrome['labels'] = self._get_whitelabelling()
}}}
In case of an exception during request processing, the
post_process_request method is called with all None parameters, so method
returns before {{{req.chrome['labels']}}} is filled.
Should we move line
{{{ req.chrome['labels'] = self._get_whitelabelling()}}}
before the if/return statement?
--
Ticket URL: <https://issues.apache.org/bloodhound/ticket/330#comment:12>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker