Page MenuHomePhabricator ignores -namespace: parameter
Closed, ResolvedPublic


When I updated bot after long time, there is unexpected behavior: newitem -namespace:0 -unconnectedpages:5000
creates wikidata item for all namespaces

how to write this comand correctly?

in is written that for some scripts must be -namespace parameter before pagegenerator, but I have it and is not between these scripts.

Event Timeline

JAnD created this task.Jun 7 2018, 9:18 AM
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald TranscriptJun 7 2018, 9:18 AM
JAnD updated the task description. (Show Details)Jun 7 2018, 9:19 AM

I can reproduce this (output: WARNING: querypage module does not support a namespace parameter) and suspect rPWBCbdeea71e129f0bc9b1a36e75388dfc576c7275ce is behind this.

matej_suchanek triaged this task as High priority.Jun 21 2018, 4:04 PM

Change 442910 had a related patch set uploaded (by Multichill; owner: Multichill):
[pywikibot/core@master] T196619 Revert "[cleanup] Deprecate pagegenerators.UnconnectedPageGenerator"

@Xqt : Why are you deprecating perfectly valid generators?

Buh, simple revert and rebase doesn't work.

Looks like a no-op to me.

Scratch that. It is relevant, yes, but the original implementation of using a layer of 'indirectness' is not good.

The bug is caused by the combination of and

if isinstance(self.gens[i],
    if self.namespaces:
    if self.limit:
    if self.namespaces:
        self.gens[i] = NamespaceFilterPageGenerator(self.gens[i],
    if self.limit:
        self.gens[i] = itertools.islice(self.gens[i], self.limit)
param ='query+' + self.limited_module,
if not param:
    pywikibot.warning(u'{0} module does not support a namespace '

The caller recognizes that it is an API Query generator and therefore asks the generator itself to do the filtering, instead using our own filtering system. This is completely logical, however, querypage MediaWiki API module can't filter by namespace, and the callee just ignored the request, only displaying a warning, leaving the caller no way of knowing this fault. I suggest changing this warning to an error/exception; what is asked should be done or let the caller know it's not done, and an exception seems most logical to me.

Yes, having UnconnectedPageGenerator would make think it's not an API Query generator, but in reality it only contributing to code smell.

Masti added a subscriber: Masti.Jun 28 2018, 8:28 PM
Xqt claimed this task.Jun 29 2018, 6:06 AM
Xqt added a project: good first task.

Change 443027 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [bugfix] Enable namespace filtering for unconnected_pages GeneratorFactory

Xqt added a comment.Jun 29 2018, 7:09 AM

As zhuyifei1999 statet the problems is the pagegenerators filtering. It assumes that QueryGenerators always have a namespace parameter. Either the api should do the filtering or pagegenerators should know whether the QueryGenerators is able to do it.

Change 443027 merged by jenkins-bot:
[pywikibot/core@master] [bugfix] Enable namespace filtering for unconnected_pages GeneratorFactory

Change 442910 abandoned by Xqt:
T196619 Revert "[cleanup] Deprecate pagegenerators.UnconnectedPageGenerator"

due to /443027/

Xqt closed this task as Resolved.Jun 29 2018, 9:04 AM

Thanks for fixing this guys. As an afterburner I found in T173293 that the API does filter by namespace, but isn't really supposed to do that. See example ...........

Vvjjkkii renamed this task from ignores -namespace: parameter to ohbaaaaaaa.Jul 1 2018, 1:05 AM
Vvjjkkii reopened this task as Open.
Vvjjkkii removed Xqt as the assignee of this task.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed subscribers: gerritbot, Aklapper.
CommunityTechBot renamed this task from ohbaaaaaaa to ignores -namespace: parameter.Jul 2 2018, 3:03 PM
CommunityTechBot closed this task as Resolved.
CommunityTechBot assigned this task to Xqt.
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot added subscribers: gerritbot, Aklapper.