Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

python: Replace deprecated BeautifulSoup.findAll.

Anders Kaseorga1983d9052e7
diff --git a/zerver/lib/import_realm.py b/zerver/lib/import_realm.py
index a3109f2890b..43251ea1c03 100644
--- a/zerver/lib/import_realm.py
+++ b/zerver/lib/import_realm.py
@@ -409,7 +409,7 @@ def fix_message_rendered_content(
# similar syntax in the rendered HTML.
soup = BeautifulSoup(message[rendered_content_key], "html.parser")
- user_mentions = soup.findAll("span", {"class": "user-mention"})
+ user_mentions = soup.find_all("span", {"class": "user-mention"})
if len(user_mentions) != 0:
user_id_map = ID_MAP["user_profile"]
for mention in user_mentions:
@@ -426,7 +426,7 @@ def fix_message_rendered_content(
mention["data-user-id"] = str(user_id_map[old_user_id])
message[rendered_content_key] = str(soup)
- stream_mentions = soup.findAll("a", {"class": "stream"})
+ stream_mentions = soup.find_all("a", {"class": "stream"})
if len(stream_mentions) != 0:
stream_id_map = ID_MAP["stream"]
for mention in stream_mentions:
@@ -435,7 +435,7 @@ def fix_message_rendered_content(
mention["data-stream-id"] = str(stream_id_map[old_stream_id])
message[rendered_content_key] = str(soup)
- user_group_mentions = soup.findAll("span", {"class": "user-group-mention"})
+ user_group_mentions = soup.find_all("span", {"class": "user-group-mention"})
if len(user_group_mentions) != 0:
user_group_id_map = ID_MAP["usergroup"]
for mention in user_group_mentions:
diff --git a/zerver/lib/url_preview/parsers/open_graph.py b/zerver/lib/url_preview/parsers/open_graph.py
index 64b2b0732c6..d9dfb4278c5 100644
--- a/zerver/lib/url_preview/parsers/open_graph.py
+++ b/zerver/lib/url_preview/parsers/open_graph.py
@@ -10,7 +10,7 @@ from .base import BaseParser
class OpenGraphParser(BaseParser):
@override
def extract_data(self) -> UrlEmbedData:
- meta = self._soup.findAll("meta")
+ meta = self._soup.find_all("meta")
data = UrlEmbedData()