1 2 3 4 5 6 7 8 | from BeautifulSoup import BeautifulSoup
class Prettify(object):
def process_response(self, request, response):
if response.has_header('Content-Type') and response['Content-Type'].startswith('text/html'):
response.content = BeautifulSoup(response.content).prettify()
return response
|
More like this
- Prettify HTML body contents in HTTP response by n1k0 2 years, 6 months ago
- Template Filter: Add indentation by Chuck Harmston 3 years, 9 months ago
- urlize HTML by maguspk 3 years ago
- Showell markup--DRY up your templates by showell 3 years, 6 months ago
- Whore links by nathan 6 years, 3 months ago
Comments