This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.conf import settings | |
class DbgResponse(object): | |
def process_response(self, request, response): | |
"""Add html, head, and body tags so debug toolbar will activate.""" | |
if request.GET.get('dbg') and settings.DEBUG: | |
cnt = response.content | |
if '<body>' not in cnt: | |
response.content = '<html><head></head><body>%s</body></html>' % cnt | |
if 'content_type' in response._headers: |