QChris has uploaded a new change for review.

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

Change subject: If desktop site starts in 'www.', drop 'www.' for mobile site
......................................................................

If desktop site starts in 'www.', drop 'www.' for mobile site

Wikidata just had the MobileFrontend extension set up. This makes a
mobile site served at 'm.wikidata.org'. We add this new scheme for
mobile site detection.

Change-Id: Ia42d0859c4ac7e461f35bb262733da8edb3d4565
---
M aggregator/util.py
M tests/test_util.py
2 files changed, 11 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/analytics/aggregator 
refs/changes/96/181396/1

diff --git a/aggregator/util.py b/aggregator/util.py
index e164e35..08ec886 100644
--- a/aggregator/util.py
+++ b/aggregator/util.py
@@ -131,6 +131,12 @@
                     abbreviation_split.insert(1, 'm')
                 elif site == 'zero':
                     abbreviation_split.insert(1, 'zero')
+
+                # fix-up mobile site where desktop site is www, like
+                # www.m.wd to m.wd
+                if abbreviation_split[0] == 'www':
+                    del abbreviation_split[0]
+
                 abbreviation = '.'.join(abbreviation_split)
 
             return abbreviation
diff --git a/tests/test_util.py b/tests/test_util.py
index c0b3c8d..c841aac 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -170,6 +170,11 @@
             'wikidatawiki')
         self.assertEqual(actual, 'www.wd')
 
+    def test_dbname_to_webstatscollector_abbreviation_wikidata_mobile(self):
+        actual = aggregator.dbname_to_webstatscollector_abbreviation(
+            'wikidatawiki', 'mobile')
+        self.assertEqual(actual, 'm.wd')
+
     def test_dbname_to_webstatscollector_abbreviation_commons(self):
         actual = aggregator.dbname_to_webstatscollector_abbreviation(
             'commonswiki')

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia42d0859c4ac7e461f35bb262733da8edb3d4565
Gerrit-PatchSet: 1
Gerrit-Project: analytics/aggregator
Gerrit-Branch: master
Gerrit-Owner: QChris <christ...@quelltextlich.at>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to