jayvdb created this task. jayvdb added a subscriber: jayvdb. jayvdb added a project: pywikibot-core. Restricted Application added subscribers: Aklapper, pywikipedia-bugs.
TASK DESCRIPTION With a sysopname set for test:test, canBeEdited() returns True, but editing the page does not work unless the sysop account is explicitly logged in.
``` $ python3 pwb.py shell Welcome to the Pywikibot interactive shell!
import pywikibot s = pywikibot.Site('test', 'test') p = pywikibot.Page(s, 'User:John Vandenberg/test protected') p.canBeEdited()
True
p.text = 'Testing 1 2 3' p.save()
Logging in to test:test as JVbot Traceback (most recent call last): File "pywikibot/site.py", line 4163, in editpage result = req.submit() File "pywikibot/data/api.py", line 1734, in submit raise APIError(**result['error']) pywikibot.data.api.APIError: protectedpage: The "editprotected" right is required to edit this page
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/lib/python3.4/code.py", line 90, in runcode exec(code, self.locals) File "<console>", line 1, in <module> File "pywikibot/tools/__init__.py", line 949, in wrapper return obj(*__args, **__kw) File "pywikibot/page.py", line 1051, in save **kwargs) File "pywikibot/page.py", line 1075, in _save raise err File "pywikibot/page.py", line 1062, in _save watch=watchval, bot=botflag, **kwargs) File "pywikibot/site.py", line 1075, in callee return fn(self, *args, **kwargs) File "pywikibot/site.py", line 4183, in editpage raise self._ep_errors[err.code](page) pywikibot.exceptions.LockedPage: Page [[test:User:John Vandenberg/test protected]] is locked. ```
None of these callers explicitly login as sysop, and two dont catch the error. ``` $ git grep canBeEdited pywikibot/page.py: def canBeEdited(self): pywikibot/page.py: if not self.canBeEdited(): scripts/blockpageschecker.py: # if not page.canBeEdited(): scripts/blockpageschecker.py: if not page.canBeEdited(): scripts/reflinks.py: if not page.canBeEdited(): scripts/replace.py: if not page.canBeEdited(): scripts/upload.py: if potential_file_page.canBeEdited():
$ grep login scripts/blockpageschecker.py scripts/reflinks.py scripts/replace.py scripts/upload.py scripts/replace.py: site.login() scripts/upload.py: self.targetSite.login()
$ grep LockedPage scripts/blockpageschecker.py scripts/reflinks.py scripts/replace.py scripts/upload.py scripts/blockpageschecker.py: except pywikibot.LockedPage: scripts/replace.py: except pywikibot.LockedPage:
```
TASK DETAIL https://phabricator.wikimedia.org/T98659
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: jayvdb Cc: pywikipedia-bugs, jayvdb, Aklapper
jayvdb added a comment.
reflinks is ok as it uses ignore_save_related_errors
and
Category.change_category catches PageSaveRelatedError
so only upload is a problem
TASK DETAIL https://phabricator.wikimedia.org/T98659
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: jayvdb Cc: pywikipedia-bugs, jayvdb, Aklapper
pywikipedia-bugs@lists.wikimedia.org