Skip to content

Commit 87286f1

Browse files
committedMar 6, 2016
Fix one more occurence and incorrect if/else order
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
1 parent 24dc3ae commit 87286f1

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed
 

Diff for: ‎nikola/plugins/command/import_wordpress.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -466,12 +466,12 @@ def import_attachment(self, item, wordpress_namespace):
466466
path = urlparse(url).path
467467
dst_path = os.path.join(*([self.output_folder, 'files'] + list(path.split('/'))))
468468
if self.no_downloads:
469+
LOGGER.info("Skipping downloading {0} => {1}".format(url, dst_path))
470+
else:
469471
dst_dir = os.path.dirname(dst_path)
470472
utils.makedirs(dst_dir)
471473
LOGGER.info("Downloading {0} => {1}".format(url, dst_path))
472474
self.download_url_content_to_file(url, dst_path)
473-
else:
474-
LOGGER.info("Skipping downloading {0} => {1}".format(url, dst_path))
475475
dst_url = '/'.join(dst_path.split(os.sep)[2:])
476476
links[link] = '/' + dst_url
477477
links[url] = '/' + dst_url
@@ -567,10 +567,13 @@ def add(our_key, wp_key, is_int=False, ignore_zero=False, is_float=False):
567567

568568
path = urlparse(url).path
569569
dst_path = os.path.join(*([self.output_folder, 'files'] + list(path.split('/'))))
570-
dst_dir = os.path.dirname(dst_path)
571-
utils.makedirs(dst_dir)
572-
LOGGER.info("Downloading {0} => {1}".format(url, dst_path))
573-
self.download_url_content_to_file(url, dst_path)
570+
if self.no_downloads:
571+
LOGGER.info("Skipping downloading {0} => {1}".format(url, dst_path))
572+
else:
573+
dst_dir = os.path.dirname(dst_path)
574+
utils.makedirs(dst_dir)
575+
LOGGER.info("Downloading {0} => {1}".format(url, dst_path))
576+
self.download_url_content_to_file(url, dst_path)
574577
dst_url = '/'.join(dst_path.split(os.sep)[2:])
575578
links[url] = '/' + dst_url
576579

0 commit comments

Comments
 (0)
Please sign in to comment.