XZise has uploaded a new change for review.

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

Change subject: [FIX] Interwiki: Ignore protcol
......................................................................

[FIX] Interwiki: Ignore protcol

Some interwikimaps use the HTTP protocol even though the family has
stored it as HTTPS. This causes that an URL isn't detected as a valid
URL even though it would work fine.

Change-Id: I62699eb1e41cb926fd66f8cd59e37927db9830cc
---
M pywikibot/family.py
1 file changed, 7 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/56/183156/1

diff --git a/pywikibot/family.py b/pywikibot/family.py
index bf04dbb..88d3da8 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -1064,9 +1064,9 @@
         """
         Return whether this family matches the given url.
 
-        The protocol must match, if it is present in the URL. It must match
-        URLs generated via C{self.langs} and L{Family.nice_get_address} or
-        L{Family.path}.
+        It must match URLs generated via C{self.langs} and
+        L{Family.nice_get_address} or L{Family.path}. If the protocol doesn't
+        match but is present in the interwikimap it'll log this.
 
         It uses L{Family._get_path_regex} to generate a regex defining the path
         after the domain.
@@ -1085,9 +1085,10 @@
         else:
             return None
         if url_match.group(1) and url_match.group(1) != self.protocol(code):
-            return None
-        else:
-            return code
+            pywikibot.log('The entry in the interwikimap uses {0} but the '
+                          'family is configured to use {1}'.format(
+                url_match.group(1), self.protocol(code)))
+        return code
 
     def maximum_GET_length(self, code):
         return config.maximum_GET_length

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

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

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

Reply via email to