Page MenuHomePhabricator

page.Save() does not support sysop parameter
Closed, ResolvedPublic

Description

In compat, page.Save can be passed sysop=True to force a sysop edit; in core, the edit just errors out:

"pywikibot.exceptions.PageNotSaved: [[MediaWiki:Gadget-false-blue-links.js]]: protectednamespace-interface: You're not allowed to

edit interface messages"

Version: core-(2.0)
Severity: normal

Details

Reference
bz58789

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 2:15 AM
bzimport added a project: Pywikibot-General.
bzimport set Reference to bz58789.
bzimport added a subscriber: Unknown Object (????).

It doesn't work because of "@must_be(group='user')" on top of Site.editpage(). Should I create a new function like Site.editpage_sysop()? Or should I remove "@must_be(group='user')"?

By the way, here is my workaround. It's ugly, though

In APISite

def performAsSysop(self, user)

self.logout()
self._username[False] = user
self.login(False)

I think we should adapt the must_be decorator to take a new runtime parameter (e.g. as_group), which would override the group defined by the original function.

(this would adapt kwargs inside must_be.decorator.callee)

I think that new parameter would not be necessary. If we call some functions whose group='user' and there is the parameter sysop=True, obviously we want to call that function as sysop but in user manner (like editing).

Change 111943 had a related patch set uploaded by Nullzero:
Support editing as a sysop

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

Change 111943 merged by jenkins-bot:
Support editing as a sysop

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

How to change the status to RESOLVED FIXED?

There should be a selection box below the comment box ('Status: [PATCH_TO_REVIEW v]'). If not, ask Andre (aklapper@wikimedia.org) for 'editbugs' rights.

However, I'm keeping this open, as def save should either get a working 'sysop=...' parameter or a @deprecated('sysop', 'as_group="sysop"') decorator.

Change 112299 had a related patch set uploaded by Nullzero:
Switch sysop parameter to as_group='sysop'

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

Change 112299 merged by jenkins-bot:
Mark sysop parameter as deprecated

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