mirror of https://github.com/dirtbags/moth.git
Merge backport for Python 3.4
This commit is contained in:
commit
58253b7a0f
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/local/bin/python3
|
||||||
|
|
||||||
import glob
|
import glob
|
||||||
import http.server
|
import http.server
|
||||||
|
@ -100,7 +100,7 @@ you are a fool.
|
||||||
body.append("* [puzzles/{cat}/{points}](/puzzles/{cat}/{points}/)".format(cat=parts[2], points=puzzle))
|
body.append("* [puzzles/{cat}/{points}](/puzzles/{cat}/{points}/)".format(cat=parts[2], points=puzzle))
|
||||||
elif len(parts) == 4:
|
elif len(parts) == 4:
|
||||||
body.append("# {} puzzle {}".format(parts[2], parts[3]))
|
body.append("# {} puzzle {}".format(parts[2], parts[3]))
|
||||||
with open("puzzles/{}/{}.moth".format(parts[2], parts[3])) as f:
|
with open("puzzles/{}/{}.moth".format(parts[2], parts[3]), encoding="utf-8") as f:
|
||||||
p = puzzles.Puzzle(f)
|
p = puzzles.Puzzle(f)
|
||||||
body.append("* Author: `{}`".format(p.fields.get("author")))
|
body.append("* Author: `{}`".format(p.fields.get("author")))
|
||||||
body.append("* Summary: `{}`".format(p.fields.get("summary")))
|
body.append("* Summary: `{}`".format(p.fields.get("summary")))
|
||||||
|
@ -133,7 +133,8 @@ you are a fool.
|
||||||
content = mdpage(text)
|
content = mdpage(text)
|
||||||
|
|
||||||
self.send_response(HTTPStatus.OK)
|
self.send_response(HTTPStatus.OK)
|
||||||
self.send_header("Content-type", "text/html; encoding=utf-8")
|
|
||||||
|
self.send_header("Content-type", "text/html; charset=utf-8")
|
||||||
self.send_header("Content-Length", len(content))
|
self.send_header("Content-Length", len(content))
|
||||||
try:
|
try:
|
||||||
fs = fspath.stat()
|
fs = fspath.stat()
|
||||||
|
|
Loading…
Reference in New Issue