Changes between Version 2 and Version 3 of StripWhitespaceMiddleware


Ignore:
Timestamp:
Dec 17, 2010, 5:11:53 PM (14 years ago)
Author:
anonymous
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • StripWhitespaceMiddleware

    v2 v3  
    99
    1010import re
     11
    1112class StripWhitespaceMiddleware:
    1213    """
    1314    Strips leading and trailing whitespace from response content.
    1415    """
     16
    1517    def __init__(self):
    1618        self.whitespace = re.compile('\s*\n')
    1719
    1820    def process_response(self, request, response):
    19         print dir(response)
    20         print response.headers
    21         if("text" in response['Content-Type'] ):
     21        if "text" in response['Content-Type']:
    2222            new_content = self.whitespace.sub('\n', response.content)
    2323            response.content = new_content
Back to Top