Changes between Version 12 and Version 13 of StripWhitespaceMiddleware
- Timestamp:
- Oct 26, 2016, 10:30:08 AM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
StripWhitespaceMiddleware
v12 v13 26 26 def __init__(self): 27 27 self.whitespace = re.compile('^\s*\n', re.MULTILINE) 28 # 29 # 28 #self.whitespace_lead = re.compile('^\s+', re.MULTILINE) 29 #self.whitespace_trail = re.compile('\s+$', re.MULTILINE) 30 30 31 31 32 32 def process_response(self, request, response): 33 33 if "text" in response['Content-Type']: 34 # Replace preceding 'if' with following commented 'if'to avoid failure on cached / HTTP 304 NOT MODIFIED responses without Content-Type34 #Use next line instead to avoid failure on cached / HTTP 304 NOT MODIFIED responses without Content-Type 35 35 #if response.status_code == 200 and "text" in response['Content-Type']: 36 36 if hasattr(self, 'whitespace_lead'):