Title: [170639] trunk/Tools
Revision
170639
Author
commit-qu...@webkit.org
Date
2014-07-01 08:22:44 -0700 (Tue, 01 Jul 2014)

Log Message

webkit-patch apply-from-bug / apply-attachment should not ask for credentials if none are required
https://bugs.webkit.org/show_bug.cgi?id=40095

Patch by Youenn Fablet <youenn.fab...@crf.canon.fr> on 2014-07-01
Reviewed by Csaba Osztrogonác.

* Scripts/webkitpy/common/net/bugzilla/bugzilla.py:
(Bugzilla.fetch_attachment_contents): make a first fetch on bugzilla without authentication. If failing, use authentication (similar to fetch_bug_dictionary).
(Bugzilla):
(Bugzilla.bug_id_for_attachment_id): ditto.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (170638 => 170639)


--- trunk/Tools/ChangeLog	2014-07-01 15:16:24 UTC (rev 170638)
+++ trunk/Tools/ChangeLog	2014-07-01 15:22:44 UTC (rev 170639)
@@ -1,3 +1,15 @@
+2014-07-01  Youenn Fablet  <youenn.fab...@crf.canon.fr>
+
+        webkit-patch apply-from-bug / apply-attachment should not ask for credentials if none are required
+        https://bugs.webkit.org/show_bug.cgi?id=40095
+
+        Reviewed by Csaba Osztrogonác.
+
+        * Scripts/webkitpy/common/net/bugzilla/bugzilla.py:
+        (Bugzilla.fetch_attachment_contents): make a first fetch on bugzilla without authentication. If failing, use authentication (similar to fetch_bug_dictionary).
+        (Bugzilla):
+        (Bugzilla.bug_id_for_attachment_id): ditto.
+
 2014-07-01  Eva Balazsfalvi  <evab.u-sze...@partner.samsung.com>
 
         [webkitpy] Refactor pluralizer in grammar.py

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


--- trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py	2014-07-01 15:16:24 UTC (rev 170638)
+++ trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py	2014-07-01 15:22:44 UTC (rev 170639)
@@ -483,9 +483,12 @@
 
     def fetch_attachment_contents(self, attachment_id):
         attachment_url = self.attachment_url_for_id(attachment_id)
-        # We need to authenticate to download patches from security bugs.
-        self.authenticate()
-        return self.browser.open(attachment_url).read()
+        # We may need to authenticate to download patches from security bugs.
+        try:
+            return self.browser.open(attachment_url).read()
+        except:
+            self.authenticate()
+            return self.browser.open(attachment_url).read()
 
     def _parse_bug_id_from_attachment_page(self, page):
         # The "Up" relation happens to point to the bug.
@@ -498,11 +501,13 @@
         return int(match.group('bug_id'))
 
     def bug_id_for_attachment_id(self, attachment_id):
-        self.authenticate()
-
         attachment_url = self.attachment_url_for_id(attachment_id, 'edit')
         _log.info("Fetching: %s" % attachment_url)
-        page = self.browser.open(attachment_url)
+        try:
+            page = self.browser.open(attachment_url)
+        except:
+            self.authenticate()
+            page = self.browser.open(attachment_url)
         return self._parse_bug_id_from_attachment_page(page)
 
     # FIXME: This should just return Attachment(id), which should be able to
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to