Permalink
Browse files

Use bytestrings throughout for Python 3 support.

  • Loading branch information...
lamby committed Sep 26, 2017
1 parent 5611c2c commit 211cd2f67e7ffee3ecd3d359d2294c08516523e5
Showing with 3 additions and 3 deletions.
  1. +1 −1 staticfiles_dotd/finders.py
  2. +1 −1 staticfiles_dotd/utils.py
  3. +1 −1 staticfiles_dotd/views.py
@@ -41,7 +41,7 @@ def _open(self, path, mode):
continue
filenames.append(filename)
return ContentFile(''.join(self.render(x) for x in sorted(filenames)))
return ContentFile(b''.join(self.render(x) for x in sorted(filenames)))
class DotDFinder(FileSystemFinder):
def __init__(self, *args, **kwargs):
@@ -7,5 +7,5 @@ def get_dotted_path(val):
def render(filename):
# A default render method
with open(filename) as f:
with open(filename, 'rb') as f:
return f.read()
@@ -65,7 +65,7 @@ def served(request, absolute_path):
return HttpResponseNotModified(content_type=mimetype)
fn = get_dotted_path(app_settings.RENDER_FN)
contents = ''.join(fn(x) for x in sorted(filenames))
contents = b''.join(fn(x) for x in sorted(filenames))
# Ensure bytes otherwise our len(contents) can be short!
contents = force_bytes(contents)

0 comments on commit 211cd2f

Please sign in to comment.