Page MenuHomePhabricator

Unable to change Proofread status via API (pywikibot)
Closed, InvalidPublic

Description

Using:
python scripts/pagefromfile.py -notitle -force -summary:'Bot request: fill List' -pt:0 -showdiff -file:'WS.txt'
I was unable to change proofread status of the page, regardless if also user is changed or not.

See two pages below.

Please note that I instrumented the script to check if the bot was logged on and whit which user.
For both cases, pywikibot reports: Logged in? True, Logged in as: MpaaBot

I have done it several times in the past. See also T134757.

Reading 'WS.txt'...


>>> Page:United States Statutes at Large Volume 33 Part 1.djvu/33 <<<
Page Page:United States Statutes at Large Volume 33 Part 1.djvu/33 already exists, ***overwriting!
@@ -1 +1 @@
- <noinclude><pagequality level="1" user="MpaaBot" />{{rh|xxxiv|LIST OF PRIVATE ACTS AND RESOLUTION.|}}
+ <noinclude><pagequality level="3" user="MpaaBot" />{{rh|xxxiv|LIST OF PRIVATE ACTS AND RESOLUTION.|}}

Edit summary: Bot request: fill List *** existing text overwritten ***
Do you want to accept these changes? ([y]es, [N]o, [a]ll, [q]uit): y
WARNING: API error proofreadpage_notallowedtext: You are not allowed to change the proofreading status of this page.
ERROR: Skipping Page:United States Statutes at Large Volume 33 Part 1.djvu/33 because of a save related error: Edit to page [[Page:United States Statutes at Large Volume 33 Part 1.djvu/33]] failed:
proofreadpage_notallowedtext: You are not allowed to change the proofreading status of this page. [help:See https://en.wikisource.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at &lt;https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce&gt; for notice of API deprecations and breaking changes.]
Logged in? True, Logged in as: MpaaBot


>>> Page:United States Statutes at Large Volume 33 Part 1.djvu/34 <<<
Page Page:United States Statutes at Large Volume 33 Part 1.djvu/34 already exists, ***overwriting!
@@ -1 +1 @@
- <noinclude><pagequality level="1" user="TarmstroBot" />{{rh||LIST OF PRIVATE ACTS AND RESOLUTION.|xxxv}}
+ <noinclude><pagequality level="3" user="MpaaBot" />{{rh||LIST OF PRIVATE ACTS AND RESOLUTION.|xxxv}}

Edit summary: Bot request: fill List *** existing text overwritten ***
Do you want to accept these changes? ([y]es, [N]o, [a]ll, [q]uit): y
WARNING: API error proofreadpage_notallowedtext: You are not allowed to change the proofreading status of this page.
ERROR: Skipping Page:United States Statutes at Large Volume 33 Part 1.djvu/34 because of a save related error: Edit to page [[Page:United States Statutes at Large Volume 33 Part 1.djvu/34]] failed:
proofreadpage_notallowedtext: You are not allowed to change the proofreading status of this page. [help:See https://en.wikisource.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at &lt;https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce&gt; for notice of API deprecations and breaking changes.]
Logged in? True, Logged in as: MpaaBot

Event Timeline

@Tpt, have you had time to look into this? Thanks!

@Tpt, could you please look into this? Thanks.

I found out that MpaaBot has no 'pagequality' rights.
Mpaa works as expected instead.
I think this is not an issue wth ProofreadPage but with permissions of users on enwikisource.

Just for the records, think the issue is with an account be logged in via OAuth or not.
Also "Mpaa" behaves differently depending on how I am logged in.

Actually I tested it with the bot account and the sysop account, both resulting in the You are not allowed to change the proofreading status of this page. error when creating a page in ns:Page.
Thus it seems that it is not possible to create or modify ns:Page using pywikibot?

command line:

pwb.py transferbot -family:wikisource -lang:it -tolang:nap -overwrite -ql:4 -prefixindex:'Pagina:Canzone_e_Ariette_nove.djvu'

output:

  Page transfer configuration
  ---------------------------
  Source: APISite("it", "wikisource")
  Target: APISite("nap", "wikisource")

  Pages to transfer: -prefixindex:Pagina:Canzone_e_Ariette_nove.djvu -ql:4

  Prefix for transferred pages:

Moving [[Pagina:Canzone e Ariette nove.djvu/1]] to [[nap:Paggena:Canzone e Ariette nove.djvu/1]]...
Sleeping for 9.2 seconds, 2020-01-15 13:26:38

WARNING: API error proofreadpage_notallowedtext: You are not allowed to change the proofreading status of this page.
Traceback (most recent call last):
File "/srv/paws/pwb/pywikibot/page.py", line 107, in handle
  func(self, *args, **kwargs)
File "/srv/paws/pwb/pywikibot/page.py", line 1293, in _save
  watch=watch, bot=botflag, **kwargs)
File "/srv/paws/pwb/pywikibot/site.py", line 1320, in callee
  return fn(self, *args, **kwargs)
File "/srv/paws/pwb/pywikibot/site.py", line 5267, in editpage
  result = req.submit()
File "/srv/paws/pwb/pywikibot/data/api.py", line 2079, in submit
  raise APIError(**result['error'])
pywikibot.data.api.APIError: proofreadpage_notallowedtext: You are not allowed to change the proofreading status of this page. [help:See https://nap.wikisource.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at &lt;https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce&gt; for notice of API deprecations and breaking changes.]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/srv/paws/pwb/pwb.py", line 250, in <module>
  if not main():
File "/srv/paws/pwb/pwb.py", line 243, in main
  run_python_file(filename, [filename] + args, argvu, file_package)
File "/srv/paws/pwb/pwb.py", line 95, in run_python_file
  main_mod.__dict__)
File "/srv/paws/pwb/scripts/transferbot.py", line 179, in <module>
  main()
File "/srv/paws/pwb/scripts/transferbot.py", line 171, in main
  targetpage.put(text, summary=summary)
File "/srv/paws/pwb/pywikibot/tools/__init__.py", line 1738, in wrapper
  return obj(*__args, **__kw)
File "/srv/paws/pwb/pywikibot/tools/__init__.py", line 1738, in wrapper
  return obj(*__args, **__kw)
File "/srv/paws/pwb/pywikibot/page.py", line 1360, in put
  **kwargs)
File "/srv/paws/pwb/pywikibot/tools/__init__.py", line 1738, in wrapper
  return obj(*__args, **__kw)
File "/srv/paws/pwb/pywikibot/tools/__init__.py", line 1738, in wrapper
  return obj(*__args, **__kw)
File "/srv/paws/pwb/pywikibot/page.py", line 1282, in save
  cc=apply_cosmetic_changes, quiet=quiet, **kwargs)
File "/srv/paws/pwb/pywikibot/page.py", line 128, in wrapper
  handle(func, self, *args, **kwargs)
File "/srv/paws/pwb/pywikibot/page.py", line 120, in handle
  raise pywikibot.OtherPageSaveError(self, err)
pywikibot.exceptions.OtherPageSaveError: Edit to page [[nap:Paggena:Canzone e Ariette nove.djvu/1]] failed:
proofreadpage_notallowedtext: You are not allowed to change the proofreading status of this page. [help:See https://nap.wikisource.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at &lt;https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce&gt; for notice of API deprecations and breaking changes.]
CRITICAL: Exiting due to uncaught exception <class 'pywikibot.exceptions.OtherPageSaveError'>

I am not sure but in this case you are creating a new page in a different wiki, using an existing page with ql=4.
Probably it is trying to set ql=4 also in the new page, violating the rule about change of status Not Proofread->Proofread, Validated.
@Tpt, any opinion?
Maybe pywikibot could be smarter here and check?

Indeed, the extension does not allow to create pages directly with the "validated" level.

@Mpaa Well, the same happens without the option ql=4.
@Tpt there is any workaround?

@Mpaa Well, the same happens without the option ql=4.

ql=4 is not the matter (it is just a filter on the pages the script should use), the 'Validated' code is inside the wikitext of the page.
Or you mean that there are other pages with lower quality level where you have the same issue?
If so, could you post it?

@Mpaa Well, the same happens without the option ql=4.

ql=4 is not the matter (it is just a filter on the pages the script should use), the 'Validated' code is inside the wikitext of the page.
Or you mean that there are other pages with lower quality level where you have the same issue?
If so, could you post it?

Actually I have been able to transfer a page with 3 quality level.
Example command: pwb.py transferbot -family:wikisource -lang:it -tolang:nap -page:'Pagina:Giuseppe Aliani, Educazione della donne 1922.djvu/75'

So, if I understand correctly, in order to transfer quality level 4 pages, I should first lower their ql.

Actually I have been able to transfer a page with 3 quality level.
Example command: pwb.py transferbot -family:wikisource -lang:it -tolang:nap -page:'Pagina:Giuseppe Aliani, Educazione della donne 1922.djvu/75'

This is correct, because a page can be created directly with ql=3.

So, if I understand correctly, in order to transfer quality level 4 pages, I should first lower their ql.

This would allow the transfer, but it would not correct to decrease ql from 4->3 since this would not reflect the correct ql on the source wiki.
transferbot.py does not support this use case because transferbot.py use ql only to filter pages but internally does not care about ql.
Your need would require to modify transferbot.py.

@Mpaa transferbot.py doesn't check the ql of the pages. The error is arisen by the API when you try to write the text.

I've found another workaround, but it requires some work: 1) transfer pages to a different namespace; 2) move the transferred pages to the Page namespace. However, it seems that some formatting is lost during the operation.

@Mpaa transferbot.py doesn't check the ql of the pages. The error is arisen by the API when you try to write the text.

I know, what I meant is that transferbot could be modified to check namespace / ql of pages and downgrade ql from 4 to 3 if no page exists at destination wiki, so the API would not throw the error you see.