Title: [262775] trunk/Tools
Revision
262775
Author
[email protected]
Date
2020-06-08 22:37:19 -0700 (Mon, 08 Jun 2020)

Log Message

[webkitpy] Check 'bug-search' returns a non null result before parsing
https://bugs.webkit.org/show_bug.cgi?id=212906

Reviewed by Jonathan Bedard.

* Scripts/webkitpy/common/net/bugzilla/bugzilla.py:
(BugzillaQueries._parse_result_count): Check quick-search query
response is non-null and a non-empty text.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (262774 => 262775)


--- trunk/Tools/ChangeLog	2020-06-09 05:29:22 UTC (rev 262774)
+++ trunk/Tools/ChangeLog	2020-06-09 05:37:19 UTC (rev 262775)
@@ -1,3 +1,14 @@
+2020-06-08  Diego Pino Garcia  <[email protected]>
+
+        [webkitpy] Check 'bug-search' returns a non null result before parsing
+        https://bugs.webkit.org/show_bug.cgi?id=212906
+
+        Reviewed by Jonathan Bedard.
+
+        * Scripts/webkitpy/common/net/bugzilla/bugzilla.py:
+        (BugzillaQueries._parse_result_count): Check quick-search query
+        response is non-null and a non-empty text.
+
 2020-06-08  Sam Weinig  <[email protected]>
 
         Extended Color: Rename Color::lighten() and Color::darken() to Color::lightened() and Color::darkened()

Modified: trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py (262774 => 262775)


--- trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py	2020-06-09 05:29:22 UTC (rev 262774)
+++ trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py	2020-06-09 05:37:19 UTC (rev 262775)
@@ -140,11 +140,11 @@
 
     # This is kinda a hack.  There is probably a better way to get this information from bugzilla.
     def _parse_result_count(self, results_page):
-        result_count_text = BeautifulSoup(results_page).find(attrs={'class': 'bz_result_count'}).string
-        if result_count_text is None:
+        result_count_text = BeautifulSoup(results_page).find(attrs={'class': 'bz_result_count'})
+        if result_count_text is None or result_count_text.string is None:
             _log.warn("BeautifulSoup returned None while finding class: bz_result_count in:\n{}".format(results_page))
             return 0
-        result_count_parts = result_count_text.strip().split(" ")
+        result_count_parts = result_count_text.string.strip().split(" ")
         if result_count_parts[0] == "Zarro":
             return 0
         if result_count_parts[0] == "One":

Modified: trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py (262774 => 262775)


--- trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py	2020-06-09 05:29:22 UTC (rev 262774)
+++ trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py	2020-06-09 05:37:19 UTC (rev 262775)
@@ -433,6 +433,7 @@
         self._assert_result_count(queries, '<span class="bz_result_count">314 bugs found.</span><span class="bz_result_count">314 bugs found.</span>', 314)
         self._assert_result_count(queries, '<span class="bz_result_count">Zarro Boogs found.</span>', 0)
         self._assert_result_count(queries, '<span class="bz_result_count">\n \nOne bug found.</span>', 1)
+        self._assert_result_count(queries, '', 0)
         self.assertRaises(Exception, queries._parse_result_count, ['Invalid'])
 
     def test_request_page_parsing(self):
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to