Changes between Version 3 and Version 4 of StripWhitespaceMiddleware


Ignore:
Timestamp:
May 31, 2011, 12:59:49 PM (13 years ago)
Author:
Cal Leeming
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • StripWhitespaceMiddleware

    v3 v4  
    66Tightens up response content by removed superflous line breaks and whitespace.
    77By Doug Van Horn
     8
     9----
     10v1.1 - 31st May 2011
     11Cal Leeming [Simplicity Media Ltd]
     12Modified regex to strip leading/trailing white space from every line, not just those with blank \n.
     13---
     14TODO: Ensure whitespace isn't stripped from within <pre> or <code> or <textarea> tags.
     15---
    816"""
    917
     
    1624
    1725    def __init__(self):
    18         self.whitespace = re.compile('\s*\n')
     26        self.whitespace = re.compile('^\s+|\s+$', re.MULTILINE)
    1927
    2028    def process_response(self, request, response):
     
    2533        else:
    2634            return response
     35
    2736}}}
Back to Top