@@ -446,9 +446,6 @@ def populate_context(self, channel):
446
446
447
447
def download_url_content_to_file (self , url , dst_path ):
448
448
"""Download some content (attachments) to a file."""
449
- if self .no_downloads :
450
- return
451
-
452
449
try :
453
450
request = requests .get (url , auth = self .auth )
454
451
if request .status_code >= 400 :
@@ -468,10 +465,13 @@ def import_attachment(self, item, wordpress_namespace):
468
465
'foo' )
469
466
path = urlparse (url ).path
470
467
dst_path = os .path .join (* ([self .output_folder , 'files' ] + list (path .split ('/' ))))
471
- dst_dir = os .path .dirname (dst_path )
472
- utils .makedirs (dst_dir )
473
- LOGGER .info ("Downloading {0} => {1}" .format (url , dst_path ))
474
- self .download_url_content_to_file (url , dst_path )
468
+ if self .no_downloads :
469
+ dst_dir = os .path .dirname (dst_path )
470
+ utils .makedirs (dst_dir )
471
+ LOGGER .info ("Downloading {0} => {1}" .format (url , dst_path ))
472
+ self .download_url_content_to_file (url , dst_path )
473
+ else :
474
+ LOGGER .info ("Skipping downloading {0} => {1}" .format (url , dst_path ))
475
475
dst_url = '/' .join (dst_path .split (os .sep )[2 :])
476
476
links [link ] = '/' + dst_url
477
477
links [url ] = '/' + dst_url
0 commit comments