incubator-bloodhound-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g..@apache.org
Subject svn commit: r1328689 - /incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py
Date Sat, 21 Apr 2012 15:17:12 GMT
Author: gjm
Date: Sat Apr 21 15:17:12 2012
New Revision: 1328689

URL: http://svn.apache.org/viewvc?rev=1328689&view=rev
Log:
theme: post process chrome links to remove trac provided stylesheets - fixes #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=1328689&r1=1328688&r2=1328689&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py (original)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py Sat Apr 21 15:17:12 2012
@@ -66,6 +66,27 @@ class BloodhoundTheme(ThemeBase):
     """Look and feel of Bloodhound issue tracker.
     """
     template = htdocs = css = screenshot = disable_trac_css = True
+    disable_all_trac_css = True
+
+    implements(IRequestFilter)
+
+    # IRequestFilter methods
+
+    def pre_process_request(self, req, handler):
+        """Pre process request filter"""
+        return handler
+
+    def post_process_request(self, req, template, data, content_type):
+        """Post process request filter.
+        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]
+        return template, data, content_type
 
 class QuickCreateTicketDialog(Component):
     implements(IRequestFilter, IRequestHandler)



Mime
View raw message