Skip to content

Commit 99f990d

Browse files
committedJul 12, 2015
Changed WordPress attachment format a bit to allow more data to be added easily.
1 parent b6d8c0e commit 99f990d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed
 

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

+6-4
Original file line numberDiff line numberDiff line change
@@ -453,11 +453,13 @@ def import_attachment(self, item, wordpress_namespace):
453453
links[link] = '/' + dst_url
454454
links[url] = '/' + dst_url
455455

456-
return [path] + self.download_additional_image_sizes(
456+
result = {}
457+
result['files'] = [path] + self.download_additional_image_sizes(
457458
item,
458459
wordpress_namespace,
459460
os.path.dirname(url)
460461
)
462+
return result
461463

462464
def download_additional_image_sizes(self, item, wordpress_namespace, source_path):
463465
if phpserialize is None:
@@ -835,12 +837,12 @@ def process_item_if_attachment(self, item):
835837
wordpress_namespace, post_type, post_id, parent_id = self._extract_item_info(item)
836838

837839
if post_type == 'attachment':
838-
files = self.import_attachment(item, wordpress_namespace)
840+
data = self.import_attachment(item, wordpress_namespace)
839841
# If parent was found, store relation with imported files
840842
if parent_id is not None and int(parent_id) != 0:
841-
self.attachments[int(parent_id)][post_id] = files
843+
self.attachments[int(parent_id)][post_id] = data
842844
else:
843-
LOGGER.warn("Attachment #{0} ({1}) has no parent!".format(post_id, files))
845+
LOGGER.warn("Attachment #{0} ({1}) has no parent!".format(post_id, data['files']))
844846

845847
def write_attachments_info(self, path, attachments):
846848
with io.open(path, "wb") as file:

0 commit comments

Comments
 (0)
Please sign in to comment.