Changes between Version 6 and Version 7 of StripWhitespaceMiddleware


Ignore:
Timestamp:
05/31/11 14:36:35 (4 years ago)
Author:
foxwhisper
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