forked from expo/troggle
Future proof for filesystem encoding changing in the future
This commit is contained in:
parent
59a45871fd
commit
f0cfed2ef6
@ -19,6 +19,9 @@ from troggle.core.models.caves import Cave
|
||||
import troggle.core.views.caves
|
||||
import troggle.settings as settings
|
||||
|
||||
import sys
|
||||
sysdefaultencoding = sys.getdefaultencoding()
|
||||
|
||||
'''Formerly a separate package called 'flatpages' written by Martin Green 2011.
|
||||
This was NOT django.contrib.flatpages which stores HTML in the database, so the name was changed to expopages.
|
||||
Then it was incorporated into troggle directly, rather than being an unnecessary external package.
|
||||
@ -224,7 +227,7 @@ def expopage(request, path):
|
||||
|
||||
try:
|
||||
t = type(filetobeopened)
|
||||
content = open(filetobeopened.encode('utf8'), "rb")
|
||||
content = open(filetobeopened.encode(sysdefaultencoding), "rb")
|
||||
content_type=getmimetype(path)
|
||||
return HttpResponse(content = content, content_type=content_type)
|
||||
except IOError:
|
||||
|
Loading…
Reference in New Issue
Block a user