mirror of
https://github.com/zulip/zulip.git
synced 2025-10-24 16:43:57 +00:00
python: Replace deprecated BeautifulSoup.findAll.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit a1983d9052)
This commit is contained in:
committed by
Tim Abbott
parent
69fb1828ca
commit
c0aeb24692
@@ -367,7 +367,7 @@ def fix_message_rendered_content(
|
|||||||
# similar syntax in the rendered HTML.
|
# similar syntax in the rendered HTML.
|
||||||
soup = BeautifulSoup(message[rendered_content_key], "html.parser")
|
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:
|
if len(user_mentions) != 0:
|
||||||
user_id_map = ID_MAP["user_profile"]
|
user_id_map = ID_MAP["user_profile"]
|
||||||
for mention in user_mentions:
|
for mention in user_mentions:
|
||||||
@@ -384,7 +384,7 @@ def fix_message_rendered_content(
|
|||||||
mention["data-user-id"] = str(user_id_map[old_user_id])
|
mention["data-user-id"] = str(user_id_map[old_user_id])
|
||||||
message[rendered_content_key] = str(soup)
|
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:
|
if len(stream_mentions) != 0:
|
||||||
stream_id_map = ID_MAP["stream"]
|
stream_id_map = ID_MAP["stream"]
|
||||||
for mention in stream_mentions:
|
for mention in stream_mentions:
|
||||||
@@ -393,7 +393,7 @@ def fix_message_rendered_content(
|
|||||||
mention["data-stream-id"] = str(stream_id_map[old_stream_id])
|
mention["data-stream-id"] = str(stream_id_map[old_stream_id])
|
||||||
message[rendered_content_key] = str(soup)
|
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:
|
if len(user_group_mentions) != 0:
|
||||||
user_group_id_map = ID_MAP["usergroup"]
|
user_group_id_map = ID_MAP["usergroup"]
|
||||||
for mention in user_group_mentions:
|
for mention in user_group_mentions:
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ from .base import BaseParser
|
|||||||
class OpenGraphParser(BaseParser):
|
class OpenGraphParser(BaseParser):
|
||||||
@override
|
@override
|
||||||
def extract_data(self) -> UrlEmbedData:
|
def extract_data(self) -> UrlEmbedData:
|
||||||
meta = self._soup.findAll("meta")
|
meta = self._soup.find_all("meta")
|
||||||
|
|
||||||
data = UrlEmbedData()
|
data = UrlEmbedData()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user