From efb623af0bcb47d510501c282e1326b11343a29c Mon Sep 17 00:00:00 2001 From: luxagraf Date: Sat, 22 Sep 2012 22:27:04 -0400 Subject: site reorg --- app/lib/grappelli/middleware.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 app/lib/grappelli/middleware.py (limited to 'app/lib/grappelli/middleware.py') 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('\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 + + -- cgit v1.2.3-70-g09d2