[Pywikibot-commits] [Gerrit] [bugfix] Enable test_detect_site for wikichristian.org - change (pywikibot/core)

2016-04-24 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: [bugfix] Enable test_detect_site for wikichristian.org
..


[bugfix] Enable test_detect_site for wikichristian.org

- SiteDetectionTestCase.test_detect_site() failed for wikichristian.org.
  I found several newlines on top of the json file and a Byte Order Mark (BOM).
  Removing them solves the problem.
- Also add a __repr__ for MWSite so show this repr string instead of the
  generic . Now we get
  the class Name with the new url where the json is fetched from

Bug: T128992
Change-Id: Ib8b4c0d5dbf645d4984d26f5ac35f8f98e1ca418
---
M pywikibot/site_detect.py
1 file changed, 7 insertions(+), 1 deletion(-)

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



diff --git a/pywikibot/site_detect.py b/pywikibot/site_detect.py
index 61ac438..a6a3003 100644
--- a/pywikibot/site_detect.py
+++ b/pywikibot/site_detect.py
@@ -104,6 +104,10 @@
 self.version < MediaWikiVersion('1.14')):
 raise RuntimeError('Unsupported version: {0}'.format(self.version))
 
+def __repr__(self):
+return '{0}("{1}")'.format(
+self.__class__.__name__, self.fromurl)
+
 @property
 def langs(self):
 """Build interwikimap."""
@@ -157,7 +161,9 @@
 def _parse_post_117(self):
 """Parse 1.17+ siteinfo data."""
 response = fetch(self.api + '?action=query&meta=siteinfo&format=json')
-info = json.loads(response.content)
+# remove preleading newlines and Byte Order Mark (BOM), see T128992
+content = response.content.strip().lstrip('\uFEFF')
+info = json.loads(content)
 self.private_wiki = ('error' in info and
  info['error']['code'] == 'readapidenied')
 if self.private_wiki:

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib8b4c0d5dbf645d4984d26f5ac35f8f98e1ca418
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt 
Gerrit-Reviewer: John Vandenberg 
Gerrit-Reviewer: Merlijn van Deen 
Gerrit-Reviewer: Mpaa 
Gerrit-Reviewer: XZise 
Gerrit-Reviewer: jenkins-bot <>

___
Pywikibot-commits mailing list
Pywikibot-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits


[Pywikibot-commits] Errored: wikimedia/pywikibot-core#3417 (master - 20faf0c)

2016-04-24 Thread Travis CI
Build Update for wikimedia/pywikibot-core
-

Build: #3417
Status: Errored

Duration: 1 hour, 1 minute, and 33 seconds
Commit: 20faf0c (master)
Author: xqt
Message: [bugfix] Enable test_detect_site for wikichristian.org

- SiteDetectionTestCase.test_detect_site() failed for wikichristian.org.
  I found several newlines on top of the json file and a Byte Order Mark (BOM).
  Removing them solves the problem.
- Also add a __repr__ for MWSite so show this repr string instead of the
  generic . Now we get
  the class Name with the new url where the json is fetched from

Bug: T128992
Change-Id: Ib8b4c0d5dbf645d4984d26f5ac35f8f98e1ca418

View the changeset: 
https://github.com/wikimedia/pywikibot-core/compare/75134ba52d9a...20faf0cf65cd

View the full build log and details: 
https://travis-ci.org/wikimedia/pywikibot-core/builds/125397549

--

You can configure recipients for build notifications in your .travis.yml file. 
See https://docs.travis-ci.com/user/notifications

___
Pywikibot-commits mailing list
Pywikibot-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits