List of steps to reproduce (step by step, including full links if applicable):
Try to get the number of pages of an Index page without any Page pages yet (i.e. a brand new index):
import pywikibot import pywikibot.proofreadpage INDEX = 'Index:The_Atlantic_Monthly_Volume_46.djvu' site = pywikibot.Site('en', 'wikisource') index = pywikibot.proofreadpage.IndexPage(site, INDEX) page = index.num_pages
What happens?:
Traceback (most recent call last): File "/tmp/./test.py", line 9, in <module> page = index.num_pages File "/usr/lib/python3.9/site-packages/pywikibot/proofreadpage.py", line 81, in wrapper self._get_page_mappings() File "/usr/lib/python3.9/site-packages/pywikibot/proofreadpage.py", line 896, in _get_page_mappings raise ValueError( ValueError: Missing class="qualityN prp-pagequality-N" or class="new" in: [[en:Index:The Atlantic Monthly Volume 46.djvu]].
What should have happened instead?:
Should return the number of pages, in this case, 882.
Looks like this is the culprit:
# Try to purge or raise ValueError. if not self._soup.find_all('a', attrs=attrs): self.purge() del self._parsed_text self._parsed_text = self._get_parsed_page() self._soup = _bs4_soup(self._parsed_text) if not self._soup.find_all('a', attrs=attrs): raise ValueError( 'Missing class="qualityN prp-pagequality-N" or ' 'class="new" in: {}.'.format(self))
I'm not sure exactly what the intention is of this check.
Version: Git master @ ca74fe2f8