From 7c018e34188dad8c06e43fbf8a32616940a42869 Mon Sep 17 00:00:00 2001
From: str4d <str4d@mail.i2p>
Date: Sat, 8 Feb 2014 22:20:21 +0000
Subject: [PATCH] Allow drafts to be viewed live (but not shown on index)

---
 i2p2www/blog/helpers.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/i2p2www/blog/helpers.py b/i2p2www/blog/helpers.py
index f5989720e..065d389e7 100644
--- a/i2p2www/blog/helpers.py
+++ b/i2p2www/blog/helpers.py
@@ -91,7 +91,10 @@ def render_blog_post(slug):
     # check if that file actually exists
     path = safe_join(BLOG_DIR, slug + ".rst")
     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
     with codecs.open(path, encoding='utf-8') as fd:
-- 
GitLab