Changes between Version 6 and Version 7 of StripWhitespaceMiddleware
- Timestamp:
- May 31, 2011, 2:36:35 PM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
StripWhitespaceMiddleware
v6 v7 25 25 26 26 def __init__(self): 27 self.whitespace = re.compile('^\s+|\s+$', re.MULTILINE) 27 self.whitespace = re.compile('^\s+', re.MULTILINE) 28 self.whitespace_trail = re.compile('\s+$', re.MULTILINE) 29 28 30 29 31 def process_response(self, request, response): 30 32 if "text" in response['Content-Type']: 31 33 new_content = self.whitespace.sub('', response.content) 34 new_content = self.whitespace_trail.sub('\n', new_content) 32 35 response.content = new_content 33 36 return response … … 35 38 return response 36 39 40 37 41 }}}