Skip to content
Permalink
Browse files
Fixed little bug, and moved code to better place.
  • Loading branch information
felixfontein committed Jul 12, 2015
1 parent 1a7c983 commit 487fdc49b40c3173572e686a78fd30807cd72480
Showing with 5 additions and 5 deletions.
  1. +5 −5 nikola/plugins/command/import_wordpress.py
@@ -415,7 +415,7 @@ def populate_context(self, channel):
context['PAGES'] = PAGES
COMPILERS = '{\n'
COMPILERS += ''' "rest": ('.txt', '.rst'),''' + '\n'
COMPILERS += ''' "markdown": ('.md', '.mdown', '.markdown')''' + '\n'
COMPILERS += ''' "markdown": ('.md', '.mdown', '.markdown'),''' + '\n'
COMPILERS += ''' "html": ('.html', '.htm'),''' + '\n'
if self.use_wordpress_compiler:
COMPILERS += ''' "wordpress": ('.wp'),''' + '\n'
@@ -842,6 +842,10 @@ def process_item_if_attachment(self, item):
else:
LOGGER.warn("Attachment #{0} ({1}) has no parent!".format(post_id, files))

def write_attachments_info(self, path, attachments):
with io.open(path, "wb") as file:
file.write(json.dumps(attachments).encode('utf-8'))

def process_item_if_post_or_page(self, item):
wordpress_namespace, post_type, post_id, parent_id = self._extract_item_info(item)

@@ -861,10 +865,6 @@ def process_item_if_post_or_page(self, item):
out_folder_slug[1] + ".attachments.json")
self.write_attachments_info(destination, attachments)

def write_attachments_info(self, path, attachments):
with io.open(path, "wb") as file:
file.write(json.dumps(attachments).encode('utf-8'))

def import_posts(self, channel):
self.attachments = defaultdict(dict)
# First process attachments

0 comments on commit 487fdc4

Please sign in to comment.