Changes between Version 1 and Version 2 of StripWhitespaceMiddleware
- Timestamp:
- Nov 7, 2006, 2:05:45 AM (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
StripWhitespaceMiddleware
v1 v2 14 14 """ 15 15 def __init__(self): 16 self.whitespace = re.compile('\s*\n +\s*')16 self.whitespace = re.compile('\s*\n') 17 17 18 18 def process_response(self, request, response): 19 new_content = self.whitespace.sub('\n', response.content) 20 response.content = new_content 21 return response 19 print dir(response) 20 print response.headers 21 if("text" in response['Content-Type'] ): 22 new_content = self.whitespace.sub('\n', response.content) 23 response.content = new_content 24 return response 25 else: 26 return response 22 27 }}}