mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 00:46:03 +00:00
bugdown: Avoid deprecated ElementTree.getchildren method.
Fixes warnings like these with python -Wd: /home/circleci/zulip/zerver/lib/bugdown/__init__.py:327: DeprecationWarning: This method will be removed in future versions. Use 'list(elem)' or iteration over elem instead. for child in currElementPair.value.getchildren(): /home/circleci/zulip/zerver/lib/bugdown/__init__.py:328: DeprecationWarning: This method will be removed in future versions. Use 'list(elem)' or iteration over elem instead. if child.getchildren(): /home/circleci/zulip/zerver/lib/bugdown/__init__.py:282: DeprecationWarning: This method will be removed in future versions. Use 'list(elem)' or iteration over elem instead. for child in currElement.getchildren(): /home/circleci/zulip/zerver/lib/bugdown/__init__.py:283: DeprecationWarning: This method will be removed in future versions. Use 'list(elem)' or iteration over elem instead. if child.getchildren(): https://docs.python.org/3.8/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element.getchildren Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
b94b350ff0
commit
0797626911
@@ -64,8 +64,7 @@ class NestedCodeBlocksRendererTreeProcessor(markdown.treeprocessors.Treeprocesso
|
||||
if parent is None:
|
||||
return
|
||||
|
||||
children = parent.getchildren()
|
||||
for index, child in enumerate(children):
|
||||
for index, child in enumerate(parent):
|
||||
if child is element_to_replace:
|
||||
parent.insert(index, replacement)
|
||||
parent.remove(element_to_replace)
|
||||
|
||||
Reference in New Issue
Block a user