Page MenuHomePhabricator

linter page generator ignores namespace filter
Closed, ResolvedPublicBUG REPORT

Description

Steps to reproduce

  1. python pwb.py touch -linter:bogus-image-options -ns:0

Expected behavior
Script should work only on pages in mainspace.

Current behavior
Script ignores the namespace parameter completely

Configuration
Python 3.7.3, Pywikibot master

Event Timeline

Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald Transcript
> python pwb.py touch -linter:bogus-image-options -ns:0
WARNING: .\scripts\touch.py:112: ArgumentDeprecationWarning: Cannot handle arg -
namespaces as namespaces can not be altered after a generator is created.
  if gen_factory.handleArg(arg):
Xqt triaged this task as Low priority.May 5 2019, 10:28 AM
Xqt subscribed.

This means pwb touch -ns:0 -linter:bogus-image-options works as expected.

See the help doc:

If used with -newpages/-random/-randomredirect/linter
generators, -namespace/ns must be provided before
-newpages/-random/-randomredirect/linter.
If used with -recentchanges generator, efficiency is
improved if -namespace is provided before -recentchanges.

Hm. Never noticed this. I would expect the order of parameters doesn't matter or at least is somehow reordered afterwards in code.

Anyway it would be at least good to improve the warning. Yesterday I had to skip all pages from other namespaces by hand because I didn't understand what the warning is trying to tell me.

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

[pywikibot/core@master] [IMPR] Prioritize -namespaces options in pg.handle_args

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

Change 790720 merged by jenkins-bot:

[pywikibot/core@master] [IMPR] Prioritize -namespaces options in pg.handle_args

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

Xqt changed the subtype of this task from "Task" to "Bug Report".May 10 2022, 6:37 PM