Skip to content

Commit

Permalink
flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
Roberto Alsina committed Dec 7, 2017
1 parent 97f1c9b commit 2b01379
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions v8/contentful/contentful_plugin.py
Expand Up @@ -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)
Expand All @@ -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:
Expand All @@ -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')
Expand Down

0 comments on commit 2b01379

Please sign in to comment.