Changes between Version 6 and Version 7 of StripWhitespaceMiddleware


Ignore:
Timestamp:
May 31, 2011, 2:36:35 PM (13 years ago)
Author:
Cal Leeming
Comment:

Patched another bug which caused \n to be stripped without replacement.

Legend:

Unmodified
Added
Removed
Modified
  • StripWhitespaceMiddleware

    v6 v7  
    2525
    2626    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
    2830
    2931    def process_response(self, request, response):
    3032        if "text" in response['Content-Type']:
    3133            new_content = self.whitespace.sub('', response.content)
     34            new_content = self.whitespace_trail.sub('\n', new_content)
    3235            response.content = new_content
    3336            return response
     
    3538            return response
    3639
     40
    3741}}}
Back to Top