Page MenuHomePhabricator

botMayEdit() raises UnsupportedPageError for Page('Talk:Israeli invasion of the Gaza Strip (2023–present)') on the English Wikipedia
Closed, ResolvedPublic

Description

See https://en.wikipedia.org/w/index.php?title=Wikipedia:Village_pump_(technical)&oldid=1224183973 where a full traceback is given under the heading "ChristieBot unable to edit Talk:Israeli invasion of the Gaza Strip (2023–present)".

The bot has "edit protected" set to yes, and has the extended-confirmed user right, but when attempting to modify the text of the semi-protected talk page it raises UnsupportedPageError: Page [[en:Special:Log]] is not supported due to namespace restriction..

>>> import pywikibot
>>> site = pywikibot.Site('wikipedia:en')
>>> page = pywikibot.Page(site, 'Talk:Israeli invasion of the Gaza Strip (2023–present)')
>>> page.botMayEdit()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jjmc89/wrk/pwb/pywikibot/page/_basepage.py", line 1158, in botMayEdit
    self._bot_may_edit = self._check_bot_may_edit()
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jjmc89/wrk/pwb/pywikibot/page/_basepage.py", line 1175, in _check_bot_may_edit
    templates = self.templatesWithParams()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jjmc89/wrk/pwb/pywikibot/page/_page.py", line 78, in templatesWithParams
    titles = {t.title() for t in self.templates()}
                                 ^^^^^^^^^^^^^^^^
  File "/home/jjmc89/wrk/pwb/pywikibot/page/_basepage.py", line 1624, in templates
    self._templates = set(self.itertemplates(content=content))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen _collections_abc>", line 330, in __next__
  File "/home/jjmc89/wrk/pwb/pywikibot/tools/collections.py", line 279, in send
    return next(self._started_gen)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jjmc89/wrk/pwb/pywikibot/data/api/_generators.py", line 625, in generator
    yield from self._extract_results(resultdata)
  File "/home/jjmc89/wrk/pwb/pywikibot/data/api/_generators.py", line 567, in _extract_results
    result = self.result(item)
             ^^^^^^^^^^^^^^^^^
  File "/home/jjmc89/wrk/pwb/pywikibot/data/api/_generators.py", line 736, in result
    update_page(p, pagedata, self.props)
  File "/home/jjmc89/wrk/pwb/pywikibot/data/api/_generators.py", line 983, in update_page
    _update_pageid(page, pagedict)
  File "/home/jjmc89/wrk/pwb/pywikibot/data/api/_generators.py", line 882, in _update_pageid
    raise UnsupportedPageError(page)
pywikibot.exceptions.UnsupportedPageError: Page [[en:Special:Log]] is not supported due to namespace restriction.

Event Timeline

coldchrist renamed this task from Editing protected pages fails with "Page en:Special:Log is not supported due to namespace restriction to Editing protected pages fails with "Page en:Special:Log is not supported due to namespace restriction".May 16 2024, 8:31 PM
JJMC89 renamed this task from Editing protected pages fails with "Page en:Special:Log is not supported due to namespace restriction" to botMayEdit() raises UnsupportedPageError for Page('Talk:Israeli invasion of the Gaza Strip (2023–present)') on the English Wikipedia.May 16 2024, 8:45 PM
JJMC89 updated the task description. (Show Details)

{{edit extended-protected|answered=no}} is somehow transcluding Special:Log into the page.

{{edit extended-protected|answered=no}} is somehow transcluding Special:Log into the page.

I'd hazard it's something from https://en.wikipedia.org/wiki/Module:Protected_edit_request/active#L-87--L-90

Xqt subscribed.

The design of Page.templates() as well as Page.itertemplates() are influenced from compat version where only templates (ns 10) are given. That might be the reason why those both page methods do not support a namespaces parameter like pagetemplates do and the documentation also has only templates in mind: Return a list of/Iterate Page objects for templates used on this Page. Template parameters are ignored. This method only returns embedded templates, ...

I think that namespaces parameter should be introduced there.

Xqt triaged this task as High priority.May 17 2024, 2:29 PM

Change #1033691 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] [WIP] T365199

https://gerrit.wikimedia.org/r/1033691

Change #1033691 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] [Fix] Add namespaces parameter to BasePage.templates and itertemplates

https://gerrit.wikimedia.org/r/1033691

Change #1033691 merged by jenkins-bot:

[pywikibot/core@master] [Fix] Add namespaces parameter to BasePage.templates and itertemplates

https://gerrit.wikimedia.org/r/1033691