Page MenuHomePhabricator

Pywikibot cannot delete pages despite the user having sufficient rights
Closed, ResolvedPublicBUG REPORT

Description

Pywikibot cannot delete pages despite the user having sufficient rights after ee2d6d664c30. (I haven't tested other sysop actions.)

Steps to Reproduce:

  • Use Page.delete() on any page

Actual Results:

  • If sysopnames is defined in user-config.py then nothing happens.
  • If sysopnames is not defined in user-config.py then prompted with Can't delete [[*page*]]; do you want to mark it for deletion instead? ([y]es, [N]o, [a]ll):

Expected Results:

  • Page is deleted

user-config.py
family = 'wikipedia'
mylang = 'en'

usernames['wikipedia']['en'] = u'JJMC89'
sysopnames['wikipedia']['en'] = u'JJMC89' # <-- Adding/removing this changes the result.
authenticate['en.wikipedia.org'] = \
('##1##',
 '##2##',
 '##3##',
 '##4##')
groups/rights
Welcome to the Pywikibot interactive shell!
>>> pywikibot.Site().userinfo['groups']
['abusefilter', 'sysop', '*', 'user', 'autoconfirmed']
>>> pywikibot.Site().userinfo['rights']
['read', 'changetags', 'templateeditor', 'extendedconfirmed', 'suppressredirect', 'noratelimit', 'deleterevision', 'deletelogentry', 'delete', 'deletedhistory', 'deletedtext', 'undelete', 'move', 'move-subpages', 'move-rootuserpages', 'move-categorypages', 'autopatrol', 'editprotected', 'upload', 'reupload', 'reupload-shared', 'autoconfirmed', 'editsemiprotected', 'ipblock-exempt', 'markbotedits', 'apihighlimits', 'browsearchive', 'movefile', 'autoreview', 'movestable', 'tboverride', 'skipcaptcha', 'abusefilter-log-detail', 'massmessage', 'edit', 'createtalk', 'writeapi', 'abusefilter-view', 'abusefilter-log', 'reupload-own', 'createpage', 'minoredit', 'purge', 'applychangetags', 'createpagemainns']
version
Pywikibot: [https] r-pywikibot-core.git (054565e, g1, 2019/08/26, 19:50:06, OUTDATED)
Release version: 3.1.dev0
requests version: 2.12.4
  cacerts: /etc/ssl/certs/ca-certificates.crt
    certificate test: ok
Python: 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516]
Usernames for family "wikipedia":
        en: JJMC89 (also sysop)

Event Timeline

Huji triaged this task as High priority.

Change 532704 had a related patch set uploaded (by Huji; owner: Huji):
[pywikibot/core@master] Check a user's rights rather than group memberships

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

Change 532704 merged by jenkins-bot:
[pywikibot/core@master] Check a user's rights rather than group memberships

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

{5811a544278e} did not resolve the issue.

Now, with or without sysopnames in user-config.py nothing happens when Page.delete() (or Site.deletepage()) is used.

Pywikibot: [https] r-pywikibot-core.git (5811a54, g1, 2019/08/27, 08:48:32, OUTDATED)

Change 534922 had a related patch set uploaded (by Huji; owner: Huji):
[pywikibot/core@master] Fix the must_be decorator function

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

{5811a544278e} did not resolve the issue.

Now, with or without sysopnames in user-config.py nothing happens when Page.delete() (or Site.deletepage()) is used.

Pywikibot: [https] r-pywikibot-core.git (5811a54, g1, 2019/08/27, 08:48:32, OUTDATED)

That is because the decorator must_be() should return a function, but we accidentally made it return True! In all fairness, this was the very first time I had dealt with a decorator in Python. The patch above will fix it (I verified on test.wikipedia.org)

Change 534922 merged by jenkins-bot:
[pywikibot/core@master] Fix the must_be decorator function

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

Huji removed a project: Patch-For-Review.