Inductiveload created this task.
Inductiveload added a project: Pywikibot.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper.
TASK DESCRIPTION
**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
<https://phabricator.wikimedia.org/rPWBCca74fe2f80235ca44641141eca69023a5de03233>
TASK DETAIL
https://phabricator.wikimedia.org/T280357
WORKBOARD
https://phabricator.wikimedia.org/project/board/87/
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Inductiveload
Cc: Aklapper, pywikibot-bugs-list, Inductiveload, Jyoo1011, JohnsonLee01,
SHEKH, Dijkstra, Khutuck, Zkhalido, Viztor, Wenyi, Tbscho, MayS, Mdupont,
JJMC89, Dvorapa, Altostratus, Avicennasis, mys_721tx, jayvdb, Masti, Alchimista
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs