Title: [214238] trunk/Tools
Revision
214238
Author
aakash_j...@apple.com
Date
2017-03-21 17:45:15 -0700 (Tue, 21 Mar 2017)

Log Message

EWS fails to parse_bug_id_from_attachment_page after bugzilla upgrade
https://bugs.webkit.org/show_bug.cgi?id=169937
<rdar://problem/31181859>

Reviewed by Alexey Proskuryakov.

* Scripts/webkitpy/common/net/bugzilla/bugzilla.py:
(Bugzilla._parse_bug_id_from_attachment_page): Since rel tag is no longer present, parsing the bug id from bug_title. 
* Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py: Fixed unit test.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (214237 => 214238)


--- trunk/Tools/ChangeLog	2017-03-22 00:08:40 UTC (rev 214237)
+++ trunk/Tools/ChangeLog	2017-03-22 00:45:15 UTC (rev 214238)
@@ -1,5 +1,17 @@
 2017-03-21  Aakash Jain  <aakash_j...@apple.com>
 
+        EWS fails to parse_bug_id_from_attachment_page after bugzilla upgrade
+        https://bugs.webkit.org/show_bug.cgi?id=169937
+        <rdar://problem/31181859>
+
+        Reviewed by Alexey Proskuryakov.
+
+        * Scripts/webkitpy/common/net/bugzilla/bugzilla.py:
+        (Bugzilla._parse_bug_id_from_attachment_page): Since rel tag is no longer present, parsing the bug id from bug_title. 
+        * Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py: Fixed unit test.
+
+2017-03-21  Aakash Jain  <aakash_j...@apple.com>
+
         ews should indicate in logs when it fails to parse_bug_id_from_attachment_page
         https://bugs.webkit.org/show_bug.cgi?id=169927
 

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


--- trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py	2017-03-22 00:08:40 UTC (rev 214237)
+++ trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py	2017-03-22 00:45:15 UTC (rev 214238)
@@ -486,11 +486,14 @@
 
     def _parse_bug_id_from_attachment_page(self, page):
         # The "Up" relation happens to point to the bug.
-        up_link = BeautifulSoup(page).find('link', rel='Up')
-        if not up_link:
+        title = BeautifulSoup(page).find('div', attrs={'id':'bug_title'})
+        if not title :
             _log.warning("This attachment does not exist (or you don't have permissions to view it).")
             return None
-        match = re.search("show_bug.cgi\?id=(?P<bug_id>\d+)", up_link['href'])
+        match = re.search("show_bug.cgi\?id=(?P<bug_id>\d+)", str(title))
+        if not match:
+            _log.warning("Unable to parse bug id from attachment")
+            return None
         return int(match.group('bug_id'))
 
     def bug_id_for_attachment_id(self, attachment_id):

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


--- trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py	2017-03-22 00:08:40 UTC (rev 214237)
+++ trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py	2017-03-22 00:45:15 UTC (rev 214238)
@@ -238,8 +238,9 @@
   <head>
     <title>
   Attachment 41073 Details for Bug 27314</title>
-<link rel="Top" href=""
-    <link rel="Up" href=""
+<div id="bug_title">
+  Attachment 41073 Details for
+  <a class="bz_bug_link bz_status_ASSIGNED " title="Sample bug" href="" 27314</a>: Sample bug</div>
 """
 
     def test_attachment_detail_bug_parsing(self):
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to