Allow drafts to be viewed live (but not shown on index)

This commit is contained in:
str4d
2014-02-08 22:20:21 +00:00
parent 58343a85ae
commit 7c018e3418

View File

@ -91,7 +91,10 @@ def render_blog_post(slug):
# check if that file actually exists # check if that file actually exists
path = safe_join(BLOG_DIR, slug + ".rst") path = safe_join(BLOG_DIR, slug + ".rst")
if not os.path.exists(path): if not os.path.exists(path):
abort(404) # check for drafts
path = safe_join(BLOG_DIR, slug + ".rst.draft")
if not os.path.exists(path):
abort(404)
# read file # read file
with codecs.open(path, encoding='utf-8') as fd: with codecs.open(path, encoding='utf-8') as fd: