Xqt has uploaded a new change for review.

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

Change subject: [bugfix] Ignore InvalidTitleError in Site.preloadpages
......................................................................

[bugfix] Ignore InvalidTitleError in Site.preloadpages

preloadpages should not break a script for an InvalidTitleError.
Print an error message and skip that page.

Bug: T130907
Change-Id: Ie61e10719aa7c32d84fb6c252dd9c34f35c088cf
---
M pywikibot/site.py
1 file changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/84/279584/1

diff --git a/pywikibot/site.py b/pywikibot/site.py
index b198dc2..555f794 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -3097,7 +3097,12 @@
         for sublist in itergroup(pagelist, groupsize):
             pageids = [str(p._pageid) for p in sublist
                        if hasattr(p, "_pageid") and p._pageid > 0]
-            cache = dict((p.title(withSection=False), p) for p in sublist)
+            cache = {}
+            for p in sublist:
+                try:
+                    cache[p.title(withSection=False)] = p
+                except pywikibot.InvalidTitle:
+                    pywikibot.exception()
 
             props = "revisions|info|categoryinfo"
             if templates:

-- 
To view, visit https://gerrit.wikimedia.org/r/279584
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie61e10719aa7c32d84fb6c252dd9c34f35c088cf
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to