Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.

Commit 6610145

Browse files
committed
WSGI has to yield bytes
1 parent abf6593 commit 6610145

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

sassutils/wsgi.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,18 @@ def __call__(self, environ, start_response):
8080
except (IOError, OSError):
8181
break
8282
except CompileError as e:
83-
start_response(self.error_status,
84-
[('Content-Type', 'text/css')])
83+
start_response(
84+
self.error_status,
85+
[('Content-Type', 'text/css; charset=utf-8')]
86+
)
8587
return [
86-
'/*\n', str(e), '\n*/\n\n',
87-
'body:before { content: ',
88-
self.quote_css_string(str(e)),
89-
'; color: maroon; background-color: white; }'
88+
b'/*\n', str(e).encode('utf-8'), b'\n*/\n\n',
89+
b'body:before { content: ',
90+
self.quote_css_string(str(e)).encode('utf-8'),
91+
b'; color: maroon; background-color: white; }'
9092
]
9193
out = start_response('200 OK', [('Content-Type', 'text/css')])
92-
with open(os.path.join(package_dir, result), 'r') as in_:
94+
with open(os.path.join(package_dir, result), 'rb') as in_:
9395
while 1:
9496
chunk = in_.read(4096)
9597
if chunk:

0 commit comments

Comments
 (0)