jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1312241?usp=email )

Change subject: MWSite: raise the Exception if self.private_wiki value cannot 
be set
......................................................................

MWSite: raise the Exception if self.private_wiki value cannot be set

If _parse_site() leads to an exception, raise it if private_wiki
variable cannot be set. Otherwise raise the
RuntimeError(Unable to determine articlepath)

Change-Id: I9e2262ae5c68fc35054bb6e378ba76f2712b5217
---
M pywikibot/site_detect.py
1 file changed, 5 insertions(+), 0 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/pywikibot/site_detect.py b/pywikibot/site_detect.py
index bcbd627..0c255b5 100644
--- a/pywikibot/site_detect.py
+++ b/pywikibot/site_detect.py
@@ -61,6 +61,7 @@
         self.server = wp.server
         self.scriptpath = wp.scriptpath
         self.articlepath = None
+        self.private_wiki = None

         if self.api:
             try:
@@ -69,6 +70,7 @@
                 raise
             except Exception as e:
                 pywikibot.log(f'MW detection failed: {e!r}')
+                self.private_wiki = e

             if not self.version:
                 self._fetch_old_version()
@@ -80,6 +82,9 @@
             raise RuntimeError(f'Unsupported version: {self.version}')

         if not self.articlepath:
+            if isinstance(self.private_wiki, Exception):
+                raise self.private_wiki
+
             if not self.private_wiki:
                 raise RuntimeError(
                     f'Unable to determine articlepath: {self.fromurl}')

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1312241?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I9e2262ae5c68fc35054bb6e378ba76f2712b5217
Gerrit-Change-Number: 1312241
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to