Page MenuHomePhabricator

Generator for Wanted:Templates (Modules later) in transferbot.py
Closed, ResolvedPublicFeature

Description

get a generator of the list of Wanted:Templates/subtemplates in order to copy all the Wikipedia templates needed on a target wiki thanks to the script transfertbot.py
The list of wanted templates could be find on :
target.wiki/Special:WantedTemplates
and thnaks to api
target.wiki/Special:ApiSandbox#action=query&format=json&prop=categories&list=querypage&qppage=Wantedtemplates

Because of many dependencies this script will has to be run several times to get all the templates wanted

Event Timeline

Dvorapa renamed this task from Generator for subtemplates to Generator for subtemplates in transferbots.May 18 2019, 1:17 PM
Nicolas_NALLET renamed this task from Generator for subtemplates in transferbots to Generator for Wanted:Templates (Modules later) in transferbot.py.May 18 2019, 1:25 PM
Nicolas_NALLET updated the task description. (Show Details)

Isn't this a pagegenerators issue. I guess you can retrieve those pages with -querypage option

ok and how I put the results on the transfert bot command ?

python pwb.py transferbot -v -family:wikipedia -lang:sv -tolang:sv -tofamily:targetwiki -overwrite -ns:10

Refer the doc e.g. pwb transferbot -help

The Wantedtemplates can be retrieved by -querypage:Wantedtemplates option or -wantedtemplates

Thanks a lot ! But the problem is this option return wanted templates of the source wiki, what I need is the list of wantedtemplates of the target wiki. I did'nt find this option on the doc...

Just for understanding: You want to move all templates from source if they are wanted templates in destination?

Xqt triaged this task as Low priority.May 18 2019, 3:33 PM
Xqt changed the subtype of this task from "Task" to "Feature Request".

Just to test, I would like to edit the file pagegenerator.py
line 795

return self.site.wantedtemplates(total=_int_none(value))

What should I write instead of

self.site

to make it work ?
Thanks

Just to test, I would like to edit the file pagegenerator.py
line 795

return self.site.wantedtemplates(total=_int_none(value))

What should I write instead of

self.site

to make it work ?
Thanks

GeneratorFactory class can be instantiated with the target site to retrieve wanted pages from target in line 100 of transferbot.py

gen_factory = pagegenerators.GeneratorFactory(target_site)

for example. Unfortunately target_site is known after argument handling. This means pagegenerators options must be collected and passed to the gen_factory later.

Change 517186 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [FEAT] Use generator from target site for transfer pages

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

Change 517186 merged by jenkins-bot:
[pywikibot/core@master] [FEAT] Use generator from target site for transfer pages

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

Framawiki subscribed.

Hello @Nicolas_NALLET :) Change merged.