You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2025/09/08 21:10:16 UTC

(allura) 02/02: fix some beautifulsoup warnings

This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a commit to branch db/email_confirmed_date
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 70685c27b37e40995ac98db25e77262e4fc1ee69
Author: Dave Brondsema <db...@slashdotmedia.com>
AuthorDate: Mon Sep 8 16:02:48 2025 -0400

    fix some beautifulsoup warnings
---
 Allura/allura/scripts/trac_export.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Allura/allura/scripts/trac_export.py b/Allura/allura/scripts/trac_export.py
index 2341d2423..9ee6c0185 100644
--- a/Allura/allura/scripts/trac_export.py
+++ b/Allura/allura/scripts/trac_export.py
@@ -166,11 +166,11 @@ def parse_ticket(self, id):
         html2text.BODY_WIDTH = 0
         url = self.full_url(self.TICKET_URL % id)
         self.log_url(url)
-        d = BeautifulSoup(urlopen(url))  # noqa: S310
+        d = BeautifulSoup(urlopen(url), 'lxml')  # noqa: S310
         self.clean_missing_wiki_links(d)
         desc = d.find('div', 'description').find('div', 'searchable')
         ticket['description'] = html2text.html2text(
-            desc.renderContents('utf8').decode('utf8')) if desc else ''
+            desc.encode_contents(encoding='utf8').decode('utf8')) if desc else ''
         comments = []
         relative_base_url = six.moves.urllib.parse.urlparse(self.full_url(self.TICKET_URL % '')).path
         for comment in d.find_all('form', action='#comment'):
@@ -181,7 +181,7 @@ def parse_ticket(self, id):
                 comment.find('a', 'timeline')['title'].replace(' in Timeline', '').replace('See timeline at ', ''))
             changes = str(comment.find('ul', 'changes') or '')
             body = comment.find('div', 'comment')
-            body = body.renderContents('utf8').decode('utf8') if body else ''
+            body = body.encode_contents(encoding='utf8').decode('utf8') if body else ''
             body = body.replace(f'href="{relative_base_url}', 'href="')  # crude way to rewrite ticket links
             c['comment'] = html2text.html2text(changes + body)
             c['class'] = 'COMMENT'
@@ -196,7 +196,7 @@ def parse_ticket_attachments(self, id):
         url = self.full_url(self.ATTACHMENT_LIST_URL % id)
         self.log_url(url)
         f = urlopen(url)  # noqa: S310
-        soup = BeautifulSoup(f)
+        soup = BeautifulSoup(f, 'lxml')
         attach = soup.find('div', id='attachments')
         list = []
         while attach: