Page MenuHomePhabricator

Pywikibot-category works only on the first page of a generator
Closed, ResolvedPublic

Description

The add action of the category script, when provided with a generator of pages to work on (I tried both -cat and -file), works only on the first page of the generator but multiple times, one for each page in the generator. I'm working on https://wiki.pokemoncentral.it/ with pywikibot up to date with https://gerrit.wikimedia.org/r/pywikibot/core.git (via git), python 2.7.14

Event Timeline

What is the command you passed into category.py?

python pwb.py category add -cat:"Zone Sole e Luna"

then when prompted I wrote the new category (Zone Ultrasole e Ultraluna). The bot showed the differences, I answerd y (to accept changes). Then the bot went on saying

Current categories:
* Categoria:Isole
* Categoria:Zone Sole e Luna
* Categoria:Zone Alola
* Categoria:Zone Ultrasole e Ultraluna
Akala is already in Categoria:Zone Ultrasole e Ultraluna.

multiple times (Akala is the first page in the category Zone Sole e Luna), and in the end

86 pages read
1 page written
Execution time: x seconds
Read operation time: y seconds
Script terminated successfully.

I also tried with

python pwb.py category add -file:foo

where foo was a file containing the list of pages in the category Zone Sole e Luna (one name for line), but I got almost the same output, the only difference being that it didn't ask to edit Akala the first time (because it changed it with the first command, I checked on the wiki).

I tried both commands twice, getting the same issue each time.

Dalba triaged this task as High priority.Mar 15 2018, 9:35 PM
Dalba subscribed.

I could reproduce this issue on enwiki. Reverting e08e2ea09e919d5aac5d8d006f3c56bdbe809b0d fixed it for me.

Change 420170 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [bugfix] Set default current_page on top

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

Change 420170 merged by jenkins-bot:
[pywikibot/core@master] [bugfix] Set default current_page on top

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