Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 161036e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions nikola/nikola.py
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion nikola/plugins/command/auto/__init__.py
Expand Up @@ -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):
Expand Down

0 comments on commit 161036e

Please sign in to comment.