Hi folks, I need a little help with an error I get on commons:
WARNING: File 'File:Mausoleul Eroilor (1916 - 1919) de la Mărășești.JPG'
contains missing revisions
I understand that the file has errors, what I don't understand is *why* it is thrown when I don't get the page content when getting the page. My aim here is to speedup the generator as much as possible, because most of the pages will be skipped.
The generator code looks like this:
def build_generator(site, langOpt, namespace, preload):
transGen = [] for template in langOpt.get(_db).get('codeTemplate'): row_template = pywikibot.Page( site, '%s:%s' % (site.namespace(10), template) ) transGen.append( row_template.getReferences(follow_redirects=False, content=False) ) combined_gen = itertools.chain(*transGen) combined_gen = filter_unique(combined_gen, key=hash) pre_generator = pagegenerators.NamespaceFilterPageGenerator( combined_gen, frozenset([namespace]), site ) return pre_generatorIs there something in those filters that makes the site throw that error?
Can I simplify them to load as few things as possible?
Thanks, Strainu
Hi, my understanding is content=False only disables fetching wikitext; it does not disable file revision information. Pywikibot’s PageGenerator still requests imageinfo, and that’s where the warning comes from. The filters themselves aren’t loading the content.
One thing that should help is passing namespaces=[namespace] directly to getReferences(), so the API filters out pages you don’t need:
page.getReferences( follow_redirects=False, namespaces=[namespace], content=False, )
You can then remove NamespaceFilterPageGenerator. However, if you’re selecting the File namespace, this won’t prevent the warning, since file revision information is still fetched for those results.
If you only need pages that transclude the templates, adding only_template_inclusion=True should also reduce the work, as the default includes ordinary backlinks too.
Thank you.
tm.