Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
flake8
  • Loading branch information
ralsina committed Jun 11, 2015
1 parent d80bba2 commit 26faadd
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions v7/import_gplus/import_gplus.py
Expand Up @@ -25,18 +25,19 @@
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

from __future__ import unicode_literals, print_function
import datetime
import json
import os
import time
try:
from urlparse import urlparse
except ImportError:
from urllib.parse import urlparse # NOQA
from zipfile import ZipFile

import dateutil
import micawber
try:
import micawber
except ImportError:
micawber = None # NOQA

from nikola.plugin_categories import Command
from nikola import utils
Expand Down Expand Up @@ -65,6 +66,9 @@ def _execute(self, options, args):
print(self.help())
return

if micawber is None:
req_missing(['micawber'], 'import from Google+')

options['filename'] = args[0]
self.export_file = options['filename']
self.output_folder = options['output_folder']
Expand All @@ -75,7 +79,7 @@ def _execute(self, options, args):
gplus_names = [x for x in zipfile.namelist() if '/Google+ Stream/' in x]
self.context = self.populate_context(zipfile, gplus_names)
conf_template = self.generate_base_site()
self.write_configuration(self.get_configuration_output_path(), conf_template.render(**prepare_config(self.context)))
self.write_configuration(self.get_configuration_output_path(), conf_template.render(**prepare_config(self.context)))
self.import_posts(zipfile, gplus_names)

@staticmethod
Expand Down Expand Up @@ -132,9 +136,7 @@ def import_posts(self, zipfile, names):
content += '\n<div> {} </div>\n'.format(micawber.parse_text(obj["url"], providers))

tags = []
self.write_metadata(os.path.join(self.output_folder, out_folder,
slug + '.meta'),
title, slug, post_date, description, tags)
self.write_metadata(os.path.join(self.output_folder, out_folder, slug + '.meta'), title, slug, post_date, description, tags)
self.write_content(
os.path.join(self.output_folder, out_folder, slug + '.html'),
content)
Expand Down

0 comments on commit 26faadd

Please sign in to comment.