Page MenuHomePhabricator

Fix the warning about no doc_subpages dict in wikinews_family.py file
Closed, ResolvedPublic

Description

>>> s = Site('en', 'wikinews')
>>> s.doc_subpage
()
WARNING: <string>:1: FamilyMaintenanceWarning: Site wikinews:en has no doc_subpages dict in wikinews_family.py file

Event Timeline

Is there any good source for them?

Answer: Yes, it is! Pywikibot!

Dvorapa triaged this task as Medium priority.

TemplateData way

import pywikibot as w
f=w.Site('cs', 'wikipedia').family  # or wikinews
for l in f.codes:
    m=w.Site(l, f).mediawiki_messages(['Templatedata-doc-subpage'])
    if m['Templatedata-doc-subpage'] != 'doc':
        print("'" + l + "': ('/" + m['Templatedata-doc-subpage'] + "', ),")

Note: !! Needs to filter out /TemplateData subpages and find doc pages there manually

OR

Most used template way

dotaz = '''
...
'''
gen = pagegenerators.WikidataSPARQLPageGenerator(dotaz, site=pywikibot.Site('wikidata', 'wikidata'))
for item in gen:
   for page in item.iterlinks():
       wiki = page.site
       # ... atd.

Note: !! Needs to filter out non-doc subpages
https://www.wikidata.org/wiki/Wikidata:Mezi_bajty#Dokumenta%C4%8Dn%C3%AD_podstr%C3%A1nky
https://www.wikidata.org/wiki/Q4847311

Change 433963 had a related patch set uploaded (by Dvorapa; owner: Dvorapa):
[pywikibot/core@master] [WIP][IMPR] Split weirdly united dict and merge duplicate dicts

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

Vvjjkkii renamed this task from Fix the warning about no doc_subpages dict in wikinews_family.py file to 9gcaaaaaaa.Jul 1 2018, 1:08 AM
Vvjjkkii removed Dvorapa as the assignee of this task.
Vvjjkkii raised the priority of this task from Medium to High.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed subscribers: gerritbot, Aklapper.
CommunityTechBot renamed this task from 9gcaaaaaaa to Fix the warning about no doc_subpages dict in wikinews_family.py file.Jul 2 2018, 4:41 AM
CommunityTechBot assigned this task to Dvorapa.
CommunityTechBot lowered the priority of this task from High to Medium.
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot added subscribers: gerritbot, Aklapper.

Change 473942 had a related patch set uploaded (by Mpaa; owner: Mpaa):
[pywikibot/core@master] [IMPR] Start filling doc_subpages for wikinews family

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

Change 473942 merged by jenkins-bot:
[pywikibot/core@master] [IMPR] Start filling doc_subpages for wikinews family

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