Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Commit

Permalink
Try to fix test failing with python 3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Mishbah committed Oct 1, 2014
1 parent ac67abe commit 26d8694
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions responsive/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

from django.template.loader import render_to_string
from django.utils.cache import patch_vary_headers
from django.utils.encoding import force_text
from django.utils.encoding import force_text, smart_bytes


from .conf import settings
from .utils import Device
Expand Down Expand Up @@ -56,7 +57,7 @@ def process_response(self, request, response):
'cookie_expires': expires.strftime('%a, %d %b %Y %H:%M:%S GMT')
})
pattern = re.compile(b'<head>', re.IGNORECASE)
response.content = pattern.sub(b'<head>' + snippet, force_text(response.content))
response.content = pattern.sub(b'<head>' + smart_bytes(snippet), response.content)

if response.get('Content-Length', None):
response['Content-Length'] = len(response.content)
Expand Down

0 comments on commit 26d8694

Please sign in to comment.