Modified: trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py (229295 => 229296)
--- trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py 2018-03-06 00:24:20 UTC (rev 229295)
+++ trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py 2018-03-06 01:30:37 UTC (rev 229296)
@@ -328,14 +328,17 @@
def setdefaulttimeout(self, value):
socket.setdefaulttimeout(value)
+ def open_url(self, url):
+ return NetworkTransaction().run(lambda: self.browser.open(url))
+
def fetch_user(self, user_id):
self.authenticate()
- edit_user_page = self.browser.open(self.edit_user_url_for_id(user_id))
+ edit_user_page = self.open_url(self.edit_user_url_for_id(user_id))
return self.edit_user_parser.user_dict_from_edit_user_page(edit_user_page)
def add_user_to_groups(self, user_id, group_names):
self.authenticate()
- user_edit_page = self.browser.open(self.edit_user_url_for_id(user_id))
+ user_edit_page = self.open_url(self.edit_user_url_for_id(user_id))
self.browser.select_form(nr=1)
for group_name in group_names:
group_string = self.edit_user_parser.group_string_from_name(user_edit_page, group_name)
@@ -469,11 +472,8 @@
def _fetch_bug_page(self, bug_id):
bug_url = self.bug_url_for_bug_id(bug_id, xml=True)
_log.info("Fetching: %s" % bug_url)
- return NetworkTransaction().run(lambda: self._fetch_bug_page_by_url(bug_url))
+ return self.open_url(bug_url)
- def _fetch_bug_page_by_url(self, bug_url):
- return self.browser.open(bug_url)
-
def fetch_bug_dictionary(self, bug_id):
try:
self.authenticate()
@@ -488,9 +488,10 @@
def fetch_attachment_contents(self, attachment_id):
attachment_url = self.attachment_url_for_id(attachment_id)
+ _log.info("Fetching: %s" % attachment_url)
# We need to authenticate to download patches from security bugs.
self.authenticate()
- return self.browser.open(attachment_url).read()
+ return self.open_url(attachment_url).read()
def _parse_bug_id_from_attachment_page(self, page):
# The "Up" relation happens to point to the bug.
@@ -512,7 +513,7 @@
attachment_url = self.attachment_url_for_id(attachment_id, 'edit')
_log.info("Fetching: %s" % attachment_url)
- page = self.browser.open(attachment_url)
+ page = self.open_url(attachment_url)
return self._parse_bug_id_from_attachment_page(page)
# FIXME: This should just return Attachment(id), which should be able to
@@ -545,7 +546,7 @@
username, password = credentials.read_credentials(use_stored_credentials=attempts == 1)
_log.info("Logging in as %s..." % username)
- self.browser.open(config_urls.bug_server_url +
+ self.open_url(config_urls.bug_server_url +
"index.cgi?GoAheadAndLogIn=1")
self.browser.select_form(name="login")
self.browser['Bugzilla_login'] = username
@@ -621,7 +622,7 @@
def add_attachment_to_bug(self, bug_id, file_or_string, description, filename=None, comment_text=None, mimetype=None):
self.authenticate()
_log.info('Adding attachment "%s" to %s' % (description, self.bug_url_for_bug_id(bug_id)))
- self.browser.open(self.add_attachment_url(bug_id))
+ self.open_url(self.add_attachment_url(bug_id))
self.browser.select_form(name="entryform")
file_object = self._file_object_for_upload(file_or_string)
filename = filename or self._filename_for_upload(file_object, bug_id)
@@ -652,7 +653,7 @@
self.authenticate()
_log.info('Adding patch "%s" to %s' % (description, self.bug_url_for_bug_id(bug_id)))
- self.browser.open(self.add_attachment_url(bug_id))
+ self.open_url(self.add_attachment_url(bug_id))
self.browser.select_form(name="entryform")
file_object = self._file_object_for_upload(file_or_string)
filename = self._filename_for_upload(file_object, bug_id, extension="patch")
@@ -708,7 +709,7 @@
self.authenticate()
_log.info('Creating bug with title "%s"' % bug_title)
- self.browser.open(config_urls.bug_server_url + "enter_bug.cgi?product=WebKit")
+ self.open_url(config_urls.bug_server_url + "enter_bug.cgi?product=WebKit")
self.browser.select_form(name="Create")
component_items = self.browser.find_control('component').items
component_names = map(lambda item: item.name, component_items)
@@ -769,7 +770,7 @@
comment_text += "\n\n%s" % additional_comment_text
_log.info(comment_text)
- self.browser.open(self.attachment_url_for_id(attachment_id, 'edit'))
+ self.open_url(self.attachment_url_for_id(attachment_id, 'edit'))
self.browser.select_form(nr=1)
self.browser.set_value(comment_text, name='comment', nr=1)
self._find_select_element_for_flag('review').value = ("X",)
@@ -786,7 +787,7 @@
self.authenticate()
_log.info(comment_text)
- self.browser.open(self.attachment_url_for_id(attachment_id, 'edit'))
+ self.open_url(self.attachment_url_for_id(attachment_id, 'edit'))
self.browser.select_form(nr=1)
if comment_text:
@@ -802,7 +803,7 @@
self.authenticate()
_log.info("Obsoleting attachment: %s" % attachment_id)
- self.browser.open(self.attachment_url_for_id(attachment_id, 'edit'))
+ 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)
@@ -819,7 +820,7 @@
self.authenticate()
_log.info("Adding %s to the CC list for bug %s" % (email_address_list, bug_id))
- self.browser.open(self.bug_url_for_bug_id(bug_id))
+ self.open_url(self.bug_url_for_bug_id(bug_id))
self.browser.select_form(name="changeform")
self.browser["newcc"] = ", ".join(email_address_list)
self.browser.submit()
@@ -828,7 +829,7 @@
self.authenticate()
_log.info("Adding comment to bug %s" % bug_id)
- self.browser.open(self.bug_url_for_bug_id(bug_id))
+ self.open_url(self.bug_url_for_bug_id(bug_id))
self.browser.select_form(name="changeform")
self.browser["comment"] = comment_text
if cc:
@@ -839,7 +840,7 @@
self.authenticate()
_log.info("Closing bug %s as fixed" % bug_id)
- self.browser.open(self.bug_url_for_bug_id(bug_id))
+ self.open_url(self.bug_url_for_bug_id(bug_id))
self.browser.select_form(name="changeform")
if comment_text:
self.browser['comment'] = comment_text
@@ -857,7 +858,7 @@
assignee = self.username
_log.info("Assigning bug %s to %s" % (bug_id, assignee))
- self.browser.open(self.bug_url_for_bug_id(bug_id))
+ self.open_url(self.bug_url_for_bug_id(bug_id))
self.browser.select_form(name="changeform")
if not self._has_control(self.browser, "assigned_to"):
@@ -878,7 +879,7 @@
# Bugzilla requires a comment when re-opening a bug, so we know it will
# never be None.
_log.info(comment_text)
- self.browser.open(self.bug_url_for_bug_id(bug_id))
+ self.open_url(self.bug_url_for_bug_id(bug_id))
self.browser.select_form(name="changeform")
bug_status = self.browser.find_control("bug_status", type="select")
# This is a hack around the fact that ClientForm.ListControl seems to