Page MenuHomePhabricator

pwb replace -subcats option is not restricting to subcategories
Closed, ResolvedPublic

Description

-subcats option is not restricting to subcategories, it is attempting to work on pages also in the given category

There does not seem to be any difference with -cat option, which is meant for pages.

Commands tried out with both options on te.wikipedia.org in PAWS environment and the log are given below

-subcats
pwb.py category -subcats:అనంతపురం_జిల్లా_మండలాలు   remove
Please enter the name of the category that should be removed: అనంతపురం జిల్లా మండలాలు
Retrieving 50 pages from wikipedia:te.
ERROR: [[అగలి మండలం]] is not in category వర్గం:అనంతపురం జిల్లా మండలాలు!
ERROR: [[అనంతపురం మండలం]] is not in category వర్గం:అనంతపురం జిల్లా మండలాలు!
....
Sleeping for 9.6 seconds, 2022-01-04 13:36:21
Page [[వర్గం:శెట్టూరు మండలంలోని గ్రామాలు]] saved
Sleeping for 9.6 seconds, 2022-01-04 13:36:32
Page [[వర్గం:సోమందేపల్లె మండలంలోని గ్రామాలు]] saved
Sleeping for 9.6 seconds, 2022-01-04 13:36:41
Page [[వర్గం:హిందూపురం మండలంలోని గ్రామాలు]] saved
-cat
pwb.py category -cat:కర్నూలు_జిల్లా_మండలాలు remove
Please enter the name of the category that should be removed: కర్నూలు జిల్లా మండలాలు
Retrieving 50 pages from wikipedia:te.
ERROR: [[ఆత్మకూరు మండలం (కర్నూలు)]] is not in category వర్గం:కర్నూలు జిల్లా మండలాలు!
ERROR: [[ఆదోని మండలం]] is not in category వర్గం:కర్నూలు జిల్లా మండలాలు!
...
Page [[వర్గం:సంజామల మండలంలోని గ్రామాలు]] saved
Sleeping for 9.6 seconds, 2022-01-04 13:48:27
Page [[వర్గం:సి.బెళగల్‌ మండలంలోని గ్రామాలు]] saved
Sleeping for 9.6 seconds, 2022-01-04 13:48:37
Page [[వర్గం:హాలహర్వి మండలంలోని గ్రామాలు]] saved
Sleeping for 9.6 seconds, 2022-01-04 13:48:47
Page [[వర్గం:హోళగుంద మండలంలోని గ్రామాలు]] saved

Event Timeline

Xqt triaged this task as High priority.Jan 4 2022, 5:01 PM
Xqt subscribed.
This comment was removed by Xqt.
Xqt lowered the priority of this task from High to Lowest.EditedJan 4 2022, 7:21 PM

Hi @Arjunaraoc: please refer the category's documentation (pwb category -help) or
https://doc.wikimedia.org/pywikibot/stable/scripts/scripts.html#module-scripts.category

The pagegenerators options like -cat or -subcats are only valid for the add action but you are using the remove action.

In this sense this task is invalid but a warning would be appropriate here I guess.

Change 751733 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] [IMPR] Show a warning if a pagegenerator option is not enabled

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

Hi @Arjunaraoc: please refer the category's documentation (pwb category -help) or
https://doc.wikimedia.org/pywikibot/stable/scripts/scripts.html#module-scripts.category

The pagegenerators options like -cat or -subcats are only valid for the add action but you are using the remove action.

In this sense this task is invalid but a warning would be appropriate here I guess.

Thanks for the clarification and corrective action.

Xqt claimed this task.

Change 751733 merged by jenkins-bot:

[pywikibot/core@master] [IMPR] Show a warning if a pagegenerator option is not enabled

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