aboutsummaryrefslogtreecommitdiff
path: root/pyblog
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xpyblog4
1 files changed, 4 insertions, 0 deletions
diff --git a/pyblog b/pyblog
index c32464e2..593dd678 100755
--- a/pyblog
+++ b/pyblog
@@ -833,6 +833,10 @@ def new_post(title):
if os.path.exists(POSTSDIR):
os.remove(POSTSDIR)
os.mkdir(POSTSDIR, mode=0o755)
+ if os.path.exists(fullpath):
+ sys.stderr.write("%serror: '%s' already exists, please pick a different title%s\n" %
+ (RED, fullpath, RESET))
+ return 1
with open(fullpath, 'w', encoding='utf-8') as newpost:
newpost.write("---\n")
newpost.write('title: "%s"\n' % title)