fix(rendercomment): markdown.util.etree -> xml.etree.ElementTree

This removes a deprecation warning.

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-11-24 20:30:16 -08:00
parent 2d0e09cd63
commit bc1cf8b1f6
No known key found for this signature in database
GPG key ID: F7E46DED420788F3

View file

@ -2,6 +2,8 @@
import sys import sys
from xml.etree.ElementTree import Element
import bleach import bleach
import markdown import markdown
import pygit2 import pygit2
@ -40,7 +42,7 @@ class FlysprayLinksInlineProcessor(markdown.inlinepatterns.InlineProcessor):
""" """
def handleMatch(self, m, data): def handleMatch(self, m, data):
el = markdown.util.etree.Element('a') el = Element('a')
el.set('href', f'https://bugs.archlinux.org/task/{m.group(1)}') el.set('href', f'https://bugs.archlinux.org/task/{m.group(1)}')
el.text = markdown.util.AtomicString(m.group(0)) el.text = markdown.util.AtomicString(m.group(0))
return (el, m.start(0), m.end(0)) return (el, m.start(0), m.end(0))
@ -73,7 +75,7 @@ class GitCommitsInlineProcessor(markdown.inlinepatterns.InlineProcessor):
# Unkwown OID; preserve the orginal text. # Unkwown OID; preserve the orginal text.
return (None, None, None) return (None, None, None)
el = markdown.util.etree.Element('a') el = Element('a')
commit_uri = aurweb.config.get("options", "commit_uri") commit_uri = aurweb.config.get("options", "commit_uri")
prefixlen = util.git_search(self._repo, oid) prefixlen = util.git_search(self._repo, oid)
el.set('href', commit_uri % (self._head, oid[:prefixlen])) el.set('href', commit_uri % (self._head, oid[:prefixlen]))