Skip to content

Commit

Permalink
Fixed little bug, and moved code to better place.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed Jul 12, 2015
1 parent 1a7c983 commit 487fdc4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions nikola/plugins/command/import_wordpress.py
Expand Up @@ -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'
Expand Down Expand Up @@ -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)

Expand All @@ -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
Expand Down

0 comments on commit 487fdc4

Please sign in to comment.