Skip to content

Commit

Permalink
Remove wildstar from XML get argument
Browse files Browse the repository at this point in the history
xml.etree.ElementTree.get()'s argument does not take
wildcards like the element-finding ones.

This caused problems with full-blown exceptions (due
to an assert) in Wiktextract:extractor/en/page.py
because the redirected templates broke stuff when
they wouldn't redirect properly.

The number of exceptions was high enough to abort
the Kaikki.org regeneration.
  • Loading branch information
kristian-clausal committed Jun 10, 2024
1 parent 6811128 commit adbe1c9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/wikitextprocessor/dumpparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def parse_dump_xml(wtp: "Wtp", dump_path: str, namespace_ids: set[int]) -> None:
if (
redirect_element := page_element.find("{*}redirect")
) is not None:
redirect_to = redirect_element.get("{*}title", "")
redirect_to = redirect_element.get("title", "")
# redirect_to existing implies a redirection, but having a
# .get default to "" is a bit weird: redirect to empty string?
# But you can't use None either..?
Expand Down

1 comment on commit adbe1c9

@xxyzz
Copy link
Collaborator

@xxyzz xxyzz commented on adbe1c9 Jun 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"title" is an attribute of the "redirect" tag, I thought it's a tag, sorry for the mistake.

Please sign in to comment.