Skip to content

Commit 62609d7

Browse files
committedJul 1, 2015
Don't use bytes for headers, it breaks in python3
1 parent 685239d commit 62609d7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed
 

Diff for: ‎nikola/plugins/command/auto/__init__.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -237,23 +237,23 @@ def serve_static(self, environ, start_response):
237237
uri = wsgiref.util.request_uri(environ)
238238
p_uri = urlparse(uri)
239239
f_path = os.path.join(self.site.config['OUTPUT_FOLDER'], *p_uri.path.split('/'))
240-
mimetype = mimetypes.guess_type(uri)[0] or b'text/html'
240+
mimetype = mimetypes.guess_type(uri)[0] or 'text/html'
241241

242242
if os.path.isdir(f_path):
243243
f_path = os.path.join(f_path, self.site.config['INDEX_FILE'])
244244

245245
if p_uri.path == '/robots.txt':
246-
start_response(b'200 OK', [(b'Content-type', 'txt/plain')])
246+
start_response('200 OK', [('Content-type', 'txt/plain')])
247247
return '''User-Agent: *\nDisallow: /\n'''
248248
elif os.path.isfile(f_path):
249249
with open(f_path) as fd:
250-
start_response(b'200 OK', [(b'Content-type', mimetype)])
250+
start_response('200 OK', [('Content-type', mimetype)])
251251
return self.inject_js(mimetype, fd.read())
252252
elif p_uri.path == '/livereload.js':
253253
with open(LRJS_PATH) as fd:
254-
start_response(b'200 OK', [(b'Content-type', mimetype)])
254+
start_response('200 OK', [('Content-type', mimetype)])
255255
return self.inject_js(mimetype, fd.read())
256-
start_response(b'404 ERR', [])
256+
start_response('404 ERR', [])
257257
return self.inject_js('text/html', ERROR_N.format(404).format(uri))
258258

259259
def inject_js(self, mimetype, data):

0 commit comments

Comments
 (0)