Changes between Version 1 and Version 2 of StripWhitespaceMiddleware


Ignore:
Timestamp:
11/07/2006 02:05:45 AM (8 years ago)
Author:
anonymous
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • StripWhitespaceMiddleware

    v1 v2  
    1414    """
    1515    def __init__(self):
    16         self.whitespace = re.compile('\s*\n+\s*')
     16        self.whitespace = re.compile('\s*\n')
    1717
    1818    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
    2227}}}
Back to Top