Skip to content

Commit

Permalink
[IMPR] ignore ValueError durig upcast of FilePage due to invalid file…
Browse files Browse the repository at this point in the history
… extension

Bug: T367777
Bug: T376452
Change-Id: Ie7e8b460e0163fc83f4f540bf29b557d0c8e0cfb
  • Loading branch information
xqt committed Oct 4, 2024
1 parent 52ec045 commit 0c6d895
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 0 additions & 2 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ Release History
* Add support for ``btmwiki`` to Pywikibot (:phab:`T368069`)
* Include image repository extensions in :attr:`site.APISite.file_extensions
<pywikibot.site._apisite.APISite.file_extensions>`
* Ignore :exc:`ValueError` durig upcast of :class:`FilePage<pywikibot.page.FilePage>` due to invalid file extension
(:phab:`T367777`)
* Add :func:`pagegenerators.SupersetPageGenerator` pagegenerator (:phab:`T367684`)
* No longer wait in :meth:`data.api.Request._http_request` for ``ImportError`` and ``NameError``
* Replace ``requests.utils.urlparse`` with ``urllib.parse.urlparse`` in
Expand Down
2 changes: 2 additions & 0 deletions ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Current Release Changes
=======================

* Ignore :exc:`ValueError` durig upcast of :class:`FilePage<pywikibot.page.FilePage>` due to invalid file extension
(:phab:`T367777`, :phab:`T376452`)
* Show a warning message for a deleted or unknown :class:`Claim<pywikibot.Claim>` type (:phab:`T374676`)
* ``preload_sites`` maintenance script was removed (:phab:`T348925`)
* Add :meth:`User.renamed_target()<pywikibot.User.renamed_target>` method
Expand Down
7 changes: 4 additions & 3 deletions pywikibot/pagegenerators/_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ def RecentChangesPageGenerator(
:class:`pywikibot.User<pywikibot.page.User>`,
:class:`pywikibot.FilePage<pywikibot.page.FilePage>` or
:class:`pywikibot.Category<pywikibot.page.Category>`.
.. versionchanged:: 9.2
.. versionchanged:: 9.4
Ignore :class:`pywikibot.FilePage<pywikibot.page.FilePage>` if it
raises a :exc:`ValueError` during upcast e.g. due to an invaild
raises a :exc:`ValueError` during upcast e.g. due to an invalid
file extension.
:param site: Site for generator results.
Expand All @@ -216,7 +216,8 @@ def upcast(gen):
except ValueError:
if pageclass == pywikibot.FilePage:
pywikibot.exception()
raise
else:
raise

if site is None:
site = pywikibot.Site()
Expand Down

0 comments on commit 0c6d895

Please sign in to comment.