Skip to content
Permalink
Browse files
flake8
  • Loading branch information
ralsina committed Dec 7, 2017
1 parent 97f1c9b commit 2b01379704f59d79e9adbc4f3015624b0fc478af
Showing with 6 additions and 3 deletions.
  1. +6 −3 v8/contentful/contentful_plugin.py
@@ -49,7 +49,8 @@ class CommandContenful(Command):
def _execute(self, options, args):
"""Import posts and pages from contenful."""
if not os.path.exists('contentful.json'):
LOGGER.error('Please put your credentials in contentful.json as described in the README.')
LOGGER.error(
'Please put your credentials in contentful.json as described in the README.')
return False
with open('contentful.json') as inf:
creds = json.load(inf)
@@ -59,7 +60,8 @@ def _execute(self, options, args):
utils.makedirs(post_dir)
for post in client.entries({'content_type': 'post'}):
fname = os.path.join(post_dir, post.slug + '.md')
metadata = {k:v for k,v in post.fields().items() if k != 'content'}
metadata = {k: v for k, v in post.fields().items()
if k != 'content'}
metadata['tags'] = ', '.join(metadata.get('tags', []))
metadata['date'] = metadata['date'].isoformat()
with open(fname, 'w+') as outf:
@@ -71,7 +73,8 @@ def _execute(self, options, args):
page_dir = os.path.join('contentful', 'pages')
utils.makedirs(page_dir)
for page in client.entries({'content_type': 'page'}):
metadata = {k:v for k,v in page.fields().items() if k != 'content'}
metadata = {k: v for k, v in page.fields().items()
if k != 'content'}
fname = os.path.join(page_dir, page.slug + '.md')
with open(fname, 'w+') as outf:
outf.write('---\n')

0 comments on commit 2b01379

Please sign in to comment.