Skip to content
Permalink
Browse files

Python 3.7 compatibility

* async is a keyword, asyncio.async was deprecated since 3.4.4
  (auto works in 3.4.4+ only)
* lxml apparently dislikes newlines now, or at least on my system
  with manual compilation

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Jul 5, 2018
1 parent 428ff63 commit 161036ec74226b851676b6920f227a674adf5731
Showing with 3 additions and 3 deletions.
  1. +2 −2 nikola/nikola.py
  2. +1 −1 nikola/plugins/command/auto/__init__.py
@@ -1406,9 +1406,9 @@ def render_template(self, template_name, output_name, context, url_type=None, is
utils.makedirs(os.path.dirname(output_name))
parser = lxml.html.HTMLParser(remove_blank_text=True)
if is_fragment:
doc = lxml.html.fragment_fromstring(data, parser)
doc = lxml.html.fragment_fromstring(data.strip(), parser)
else:
doc = lxml.html.document_fromstring(data, parser)
doc = lxml.html.document_fromstring(data.strip(), parser)
self.rewrite_links(doc, src, context['lang'], url_type)
if is_fragment:
# doc.text contains text before the first HTML, or None if there was no text
@@ -484,7 +484,7 @@ def on_any_event(self, event):

def dispatch(self, event):
"""Dispatch events to handler."""
self.loop.call_soon_threadsafe(asyncio.async, self.on_any_event(event))
self.loop.call_soon_threadsafe(asyncio.ensure_future, self.on_any_event(event))


class ConfigEventHandler(NikolaEventHandler):

0 comments on commit 161036e

Please sign in to comment.