jenkins-bot has submitted this change and it was merged. Change subject: hostname and paths should be str in generated family files ......................................................................
hostname and paths should be str in generated family files All parameters passed to request should be bytestrings - str. If any of them is accidentally unicode, this will try to convert all bytestrings to unicode via str.decode(sys.defaultencoding). This is problematic, because non-ascii data will then throw an UnicodeDecodeError as shown in [1]. The url will be converted to str on the postData level, but it is also good to prevent it from being unicode in the first place. See also: I1b66a31c8752dee1f950d425d532479f1b671926 [1] http://lists.wikimedia.org/pipermail/pywikipedia-l/2013-August/008218.html Change-Id: I5eb13d8853b6ad08b48f40b5ad881616a2f4fd2a --- M generate_family_file.py 1 file changed, 2 insertions(+), 2 deletions(-) Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified diff --git a/generate_family_file.py b/generate_family_file.py index 06464c9..aef4d11 100644 --- a/generate_family_file.py +++ b/generate_family_file.py @@ -171,7 +171,7 @@ """.lstrip() % {'url': self.base_url, 'name': self.name}) for w in self.wikis.itervalues(): - f.write(" '%(lang)s': u'%(hostname)s',\n" % {'lang': w.lang, 'hostname': urlparse(w.server).netloc}) + f.write(" '%(lang)s': '%(hostname)s',\n" % {'lang': w.lang, 'hostname': urlparse(w.server).netloc}) f.write(" }\n\n") @@ -182,7 +182,7 @@ f.write(" return {\n") for w in self.wikis.itervalues(): - f.write(" '%(lang)s': u'%(path)s',\n" % {'lang': w.lang, 'path': w.scriptpath}) + f.write(" '%(lang)s': '%(path)s',\n" % {'lang': w.lang, 'path': w.scriptpath}) f.write(" }[code]\n") f.write("\n") -- To view, visit https://gerrit.wikimedia.org/r/80229 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I5eb13d8853b6ad08b48f40b5ad881616a2f4fd2a Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/compat Gerrit-Branch: master Gerrit-Owner: Merlijn van Deen <[email protected]> Gerrit-Reviewer: Xqt <[email protected]> Gerrit-Reviewer: jenkins-bot _______________________________________________ Pywikibot-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits
