From 0190ca9fe231430aa7798841fcb4c6cd3c9e89c2 Mon Sep 17 00:00:00 2001 From: Brendan Wholihan Date: Fri, 24 May 2013 22:03:30 +0100 Subject: [PATCH] Replaced split with shlex.split Amended the file path derivation from permalink so it handles paths which end in a file extension --- acrylamid/tasks/new.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/acrylamid/tasks/new.py b/acrylamid/tasks/new.py index d2246536..a77b33b9 100644 --- a/acrylamid/tasks/new.py +++ b/acrylamid/tasks/new.py @@ -9,8 +9,9 @@ import tempfile import subprocess import shutil +import shlex -from os.path import join, dirname, isfile +from os.path import join, dirname, isfile, splitext from datetime import datetime from acrylamid import PY3, log, readers, commands, utils @@ -52,7 +53,7 @@ def run(conf, env, options): f.write(tt(title, datetime.now().strftime(conf['date_format']))) entry = readers.Entry(tmp, conf) - p = join(conf['content_dir'], dirname(entry.permalink)[1:]) + p = join(conf['content_dir'], splitext(entry.permalink.strip('/'))[0]) try: os.makedirs(p.rsplit('/', 1)[0]) @@ -73,7 +74,7 @@ def run(conf, env, options): try: if editor: - retcode = subprocess.call(editor.split() + [filepath]) + retcode = subprocess.call(shlex.split(editor) + [filepath]) elif sys.platform == 'darwin': retcode = subprocess.call(['open', filepath]) else: