Title: [149863] trunk/Tools
Revision
149863
Author
[email protected]
Date
2013-05-10 01:45:02 -0700 (Fri, 10 May 2013)

Log Message

Unicode support missing from string representation of Contributors in committers.py
https://bugs.webkit.org/show_bug.cgi?id=115859

Patch by Simon Pena <[email protected]> on 2013-05-10
Reviewed by Darin Adler.

Contributors, in committers.py, provided a string representation in __str__ which
didn't support unicode characters, so printing a contributor would fail in that case.
This patch implements __unicode__ and makes __str__ use it to represent a contributor.
The unit tests are updated accordingly, so they ensure that a unicode name can be shown.

* Scripts/webkitpy/common/config/committers.py: Move the existing string representation
to the newly implemented method __unicode__, and make __str__ display its utf-8 encoded
representation.
(Contributor.__str__):
(Contributor):
(Contributor.__unicode__):
* Scripts/webkitpy/common/config/committers_unittest.py: Add a new test that checks that
a contributor with unicode characters can be represented as a string.
(CommittersTest):
(CommittersTest.test_contributor_encoding):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (149862 => 149863)


--- trunk/Tools/ChangeLog	2013-05-10 07:41:23 UTC (rev 149862)
+++ trunk/Tools/ChangeLog	2013-05-10 08:45:02 UTC (rev 149863)
@@ -1,3 +1,26 @@
+2013-05-10  Simon Pena  <[email protected]>
+
+        Unicode support missing from string representation of Contributors in committers.py
+        https://bugs.webkit.org/show_bug.cgi?id=115859
+
+        Reviewed by Darin Adler.
+
+        Contributors, in committers.py, provided a string representation in __str__ which
+        didn't support unicode characters, so printing a contributor would fail in that case.
+        This patch implements __unicode__ and makes __str__ use it to represent a contributor.
+        The unit tests are updated accordingly, so they ensure that a unicode name can be shown.
+
+        * Scripts/webkitpy/common/config/committers.py: Move the existing string representation
+        to the newly implemented method __unicode__, and make __str__ display its utf-8 encoded
+        representation.
+        (Contributor.__str__):
+        (Contributor):
+        (Contributor.__unicode__):
+        * Scripts/webkitpy/common/config/committers_unittest.py: Add a new test that checks that
+        a contributor with unicode characters can be represented as a string.
+        (CommittersTest):
+        (CommittersTest.test_contributor_encoding):
+
 2013-05-09  Patrick Gansterer  <[email protected]>
 
         [WIN][DRT] Remove duplicated (start|stop)_javascript_Threads()

Modified: trunk/Tools/Scripts/webkitpy/common/config/committers.py (149862 => 149863)


--- trunk/Tools/Scripts/webkitpy/common/config/committers.py	2013-05-10 07:41:23 UTC (rev 149862)
+++ trunk/Tools/Scripts/webkitpy/common/config/committers.py	2013-05-10 08:45:02 UTC (rev 149863)
@@ -63,6 +63,9 @@
         return self.emails[0]
 
     def __str__(self):
+        return unicode(self).encode('utf-8')
+
+    def __unicode__(self):
         return '"%s" <%s>' % (self.full_name, self.emails[0])
 
     def contains_string(self, search_string):

Modified: trunk/Tools/Scripts/webkitpy/common/config/committers_unittest.py (149862 => 149863)


--- trunk/Tools/Scripts/webkitpy/common/config/committers_unittest.py	2013-05-10 07:41:23 UTC (rev 149862)
+++ trunk/Tools/Scripts/webkitpy/common/config/committers_unittest.py	2013-05-10 08:45:02 UTC (rev 149863)
@@ -101,6 +101,11 @@
             expected_names = [name_of_expected_contributor] if name_of_expected_contributor else []
         self.assertEqual(([contributor.full_name for contributor in contributors], distance), (expected_names, expected_distance))
 
+    # Test that the string representation of a Contributor supports unicode
+    def test_contributor_encoding(self):
+        committer_encoding = Contributor(u'\u017dan M\u00fcller', '[email protected]', 'zmuller')
+        self.assertTrue(str(committer_encoding))
+
     # Basic testing of the edit distance matching ...
     def test_contributors_by_fuzzy_match(self):
         self._assert_fuzz_match('Geoff Garen', 'Geoffrey Garen', 3)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to