Title: [255605] trunk/Tools
Revision
255605
Author
shvaikal...@gmail.com
Date
2020-02-03 15:31:31 -0800 (Mon, 03 Feb 2020)

Log Message

obsolete_attachment should not fail when flags do not exist
https://bugs.webkit.org/show_bug.cgi?id=171121

Reviewed by Jonathan Bedard.

Before this change, an error occured if a contributor without EditBugs privileges tried
to obsolete not their own attachment. With this patch, uploading routine continues with
friendly console warning like we have in reassign_bug() method.

* Scripts/webkitpy/common/net/bugzilla/bugzilla.py:
(Bugzilla):
(Bugzilla.obsolete_attachment):
(Bugzilla.reassign_bug): Use NO_EDIT_BUGS_MESSAGE constant.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (255604 => 255605)


--- trunk/Tools/ChangeLog	2020-02-03 23:26:41 UTC (rev 255604)
+++ trunk/Tools/ChangeLog	2020-02-03 23:31:31 UTC (rev 255605)
@@ -1,3 +1,19 @@
+2020-02-03  Alexey Shvayka  <shvaikal...@gmail.com>
+
+        obsolete_attachment should not fail when flags do not exist
+        https://bugs.webkit.org/show_bug.cgi?id=171121
+
+        Reviewed by Jonathan Bedard.
+
+        Before this change, an error occured if a contributor without EditBugs privileges tried
+        to obsolete not their own attachment. With this patch, uploading routine continues with
+        friendly console warning like we have in reassign_bug() method.
+
+        * Scripts/webkitpy/common/net/bugzilla/bugzilla.py:
+        (Bugzilla):
+        (Bugzilla.obsolete_attachment):
+        (Bugzilla.reassign_bug): Use NO_EDIT_BUGS_MESSAGE constant.
+
 2020-02-03  Chris Dumez  <cdu...@apple.com>
 
         Regression(r253224) WKUIDelegate.webViewDidClose may get called twice after calling _tryClose on the WKWebView

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


--- trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py	2020-02-03 23:26:41 UTC (rev 255604)
+++ trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py	2020-02-03 23:31:31 UTC (rev 255605)
@@ -308,6 +308,8 @@
 
 
 class Bugzilla(object):
+    NO_EDIT_BUGS_MESSAGE = "Ignore this message if you don't have EditBugs privileges (https://bugs.webkit.org/userprefs.cgi?tab=permissions)"
+
     def __init__(self, committers=committers.CommitterList()):
         self.authenticated = False
         self.queries = BugzillaQueries(self)
@@ -834,10 +836,16 @@
         _log.info("Obsoleting attachment: %s" % attachment_id)
         self.open_url(self.attachment_url_for_id(attachment_id, 'edit'))
         self.browser.select_form(nr=1)
-        self.browser.find_control('isobsolete').items[0].selected = True
-        # Also clear any review flag (to remove it from review/commit queues)
-        self._find_select_element_for_flag('review').value = ("X",)
-        self._find_select_element_for_flag('commit-queue').value = ("X",)
+
+        try:
+            self.browser.find_control("isobsolete").items[0].selected = True
+            # Also clear any review flag (to remove it from review/commit queues)
+            self._find_select_element_for_flag("review").value = ("X",)
+            self._find_select_element_for_flag("commit-queue").value = ("X",)
+        except (AttributeError, ValueError):
+            _log.warning("Failed to obsolete attachment")
+            _log.warning(self.NO_EDIT_BUGS_MESSAGE)
+
         if comment_text:
             _log.info(comment_text)
             # Bugzilla has two textareas named 'comment', one is somehow
@@ -903,8 +911,8 @@
         self.browser.select_form(name="changeform")
 
         if not self._has_control(self.browser, "assigned_to"):
-            _log.warning("""Failed to assign bug to you (can't find assigned_to) control.
-Ignore this message if you don't have EditBugs privileges (https://bugs.webkit.org/userprefs.cgi?tab=permissions)""")
+            _log.warning("Failed to assign bug to you (can't find assigned_to) control.")
+            _log.warning(self.NO_EDIT_BUGS_MESSAGE)
             return
 
         if comment_text:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to