summaryrefslogtreecommitdiff
path: root/app/lib/grappelli/middleware.py
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2012-09-22 22:27:04 -0400
committerluxagraf <sng@luxagraf.net>2012-09-22 22:27:04 -0400
commitefb623af0bcb47d510501c282e1326b11343a29c (patch)
tree3a35fb19f5eba3b219c65277a5fb712cbe9604ac /app/lib/grappelli/middleware.py
parent0b481fd7931c2ae20ca21f89a87f2ba6a6c01e10 (diff)
site reorg
Diffstat (limited to 'app/lib/grappelli/middleware.py')
-rw-r--r--app/lib/grappelli/middleware.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/app/lib/grappelli/middleware.py b/app/lib/grappelli/middleware.py
new file mode 100644
index 0000000..a1c45dd
--- /dev/null
+++ b/app/lib/grappelli/middleware.py
@@ -0,0 +1,23 @@
+# coding: utf-8
+
+# python imports
+import re
+
+
+class JavaScript404Patch():
+ """
+ Strip obsolete js files that cannot be removed
+ (because they are hardcoded in django's core)
+ """
+ def __init__(self):
+ self.strip = ['js/jquery.min', 'js/actions.min', 'js/collapse.min', 'js/calendar']
+ self.re = re.compile('<script.*(%s).js"></script>\n' % '|'.join(self.strip))
+
+ def process_response(self, request, response):
+ if(response and "text" in response['Content-Type'] ):
+ response.content = self.re.sub('',response.content)
+ return response
+ else:
+ return response
+
+