Author: gjm
Date: Mon Apr 23 09:21:14 2012
New Revision: 1329142
URL: http://svn.apache.org/viewvc?rev=1329142&view=rev
Log:
theme: filter the list of stylesheets directly with the list comprehension
instead of attempting to track indices - to fix error in solution for #39
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=1329142&r1=1329141&r2=1329142&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py (original)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py Mon Apr 23
09:21:14 2012
@@ -78,14 +78,14 @@ class BloodhoundTheme(ThemeBase):
def post_process_request(self, req, template, data, content_type):
"""Post process request filter.
- Removes all trac provided css if required"""
+ Removes all trac provided css if required"""
if self.disable_all_trac_css:
links = req.chrome.get('links',{})
- indices = [i for (i,ss) in enumerate(links.get('stylesheet',[]))
- if ss.get('href').startswith(req.base_path +
- '/chrome/common/css/')]
- for i in indices:
- del links['stylesheet'][i]
+ stylesheets = links.get('stylesheet',[])
+ if stylesheets:
+ path = req.base_path + '/chrome/common/css/'
+ links['stylesheet'] = [ss for ss in stylesheets
+ if not ss.get('href').startswith(path)]
return template, data, content_type
class QuickCreateTicketDialog(Component):