Anpassungen für das Hosting bei Djangoeurope und damit verbundenen Versionen Django 1.8 und Python 2.7

This commit is contained in:
Christian Berg
2015-08-05 18:55:48 +02:00
committed by Christian Berg
parent cb4b15b3c6
commit 37d3cb78c1
1355 changed files with 7289 additions and 6858 deletions

20
src/utils/middleware.py Normal file
View File

@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
"""
Created on 23.05.2011
@author: christian
"""
from django.utils.html import strip_spaces_between_tags
class CompressHtmlMiddleware(object):
"""
This Middleware compresses the HTML Output at the End. It strips the Spaces
between Tags, an at the beginning and the end of the content.
"""
def process_response(self, request, response):
if 'text/html' in response['Content-Type']:
response.content = strip_spaces_between_tags(response.content)
response.content = response.content.strip()
return response