Xqt has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1201088?usp=email )

Change subject: [IMPR] respect the ``-namespace`` option with ``-page`` option
......................................................................

[IMPR] respect the ``-namespace`` option with ``-page`` option

Bug: T409016
Change-Id: Ied3f9cb7fc0b0dee7325ef3817deb67e7b05f99b
---
M scripts/archivebot.py
1 file changed, 5 insertions(+), 2 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/scripts/archivebot.py b/scripts/archivebot.py
index 2886388..369d5cc 100755
--- a/scripts/archivebot.py
+++ b/scripts/archivebot.py
@@ -183,6 +183,9 @@
    If ``archiveheader`` is not set, the bot now attempts to retrieve a
    localized template from Wikidata (based on known item IDs). If none is
    found, ``{{talkarchive}}`` is used as fallback.
+
+.. versionchanged:: 11.0
+   The ``-namespace`` option is now respected by ``-page`` option.
 """
 #
 # (C) Pywikibot team, 2006-2025
@@ -1063,7 +1066,7 @@
         elif option == 'page':
             pagename = value
         elif option == 'namespace':
-            namespace = value
+            namespace = int(value)
         elif option == 'keep':
             keep = True
         elif option == 'sort':
@@ -1093,7 +1096,7 @@
             with open(filename) as f:
                 gen = [pywikibot.Page(site, line, ns=10) for line in f]
         elif pagename:
-            gen = [pywikibot.Page(site, pagename, ns=3)]
+            gen = [pywikibot.Page(site, pagename, ns=namespace or 3)]
         else:

             ns = [str(namespace)] if namespace is not None else []

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1201088?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ied3f9cb7fc0b0dee7325ef3817deb67e7b05f99b
Gerrit-Change-Number: 1201088
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Operator873 <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to