Skip to content

Commit beba46e

Browse files
committed
switch namespace name to use none_or()
Namespace.name was being cast to a string which led to problems for namespace 0 (simply missing from XML dumps for most wikis) which was being set to the string "None" instead of None. Switching from `str(name)` to `none_or(name, str)` fixes the issue. This is important on wikis that do not include namespace data for each <page> and where namespace issue must be inferred from the <title> in each page. Looking titles that start with "None:" is a dead end.
1 parent ddd3ea3 commit beba46e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎mw/types/namespace.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def __init__(self, id, name, canonical=None, aliases=None, case=None,
1717
Namespace ID : `int`
1818
"""
1919

20-
self.name = str(name)
20+
self.name = none_or(name, str)
2121
"""
2222
Namespace name : `str`
2323
"""

0 commit comments

Comments
 (0)