Changeset 254382 in webkit
- Timestamp:
- Jan 10, 2020 4:48:21 PM (4 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r254367 r254382 1 2020-01-10 Jonathan Bedard <jbedard@apple.com> 2 3 webkit-patch crashes when creating new bug with Python 3 4 https://bugs.webkit.org/show_bug.cgi?id=205911 5 6 Reviewed by Stephanie Lewis. 7 8 * Scripts/webkitpy/common/net/bugzilla/bugzilla.py: 9 (BugzillaQueries.is_invalid_bugzilla_email): Decode page before applying regex. 10 (Bugzilla.authenticate): Decode group before printing. 11 (Bugzilla._parse_attachment_id_from_add_patch_to_bug_response): Ensure HTML response 12 Is a string before applying the regex. 13 (Bugzilla._check_create_bug_response): Ditto. 14 * Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py: Attachment ID should be a string, 15 not a byte array. 16 1 17 2020-01-10 Alex Christensen <achristensen@webkit.org> 2 18 -
trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py
r253222 r254382 41 41 from datetime import datetime # used in timestamp() 42 42 43 from webkitpy.common.unicode_compatibility import BytesIO, StringIO, unicode 43 from webkitpy.common.unicode_compatibility import BytesIO, StringIO, unicode, decode_for 44 44 from webkitpy.common.net.bugzilla.attachment import Attachment 45 45 from webkitpy.common.net.bugzilla.bug import Bug … … 299 299 review_queue_url = "request.cgi?action=queue&requester=%s&product=&type=review&requestee=&component=&group=requestee" % urllib.quote(search_string) 300 300 results_page = self._load_query(review_queue_url) 301 return bool(re.search( "did not match anything", results_page.read()))301 return bool(re.search('did not match anything', decode_for(results_page.read(), str))) 302 302 303 303 … … 590 590 # "invalid" assume it's the login failure page. 591 591 if match and re.search(b'Invalid', match.group(1), re.IGNORECASE): 592 errorMessage = "Bugzilla login failed: %s" % match.group(1)592 errorMessage = "Bugzilla login failed: {}".format(decode_for(match.group(1), str)) 593 593 # raise an exception only if this was the last attempt 594 594 if attempts < 5: … … 666 666 @staticmethod 667 667 def _parse_attachment_id_from_add_patch_to_bug_response(response_html): 668 match = re.search(b'<title>Attachment (?P<attachment_id>\d+) added to Bug \d+</title>', response_html) 668 response_html = decode_for(response_html, str) 669 match = re.search('<title>Attachment (?P<attachment_id>\d+) added to Bug \d+</title>', response_html) 669 670 if match: 670 671 return match.group('attachment_id') … … 709 710 # FIXME: There has to be a more concise way to write this method. 710 711 def _check_create_bug_response(self, response_html): 711 match = re.search("<title>Bug (?P<bug_id>\d+) Submitted[^<]*</title>",712 712 response_html = decode_for(response_html, str) 713 match = re.search('<title>Bug (?P<bug_id>\d+) Submitted[^<]*</title>', response_html) 713 714 if match: 714 715 return match.group('bug_id') … … 720 721 error_message = "FAIL" 721 722 if match: 722 text_lines = BeautifulSoup( 723 match.group('error_message')).findAll(text=True) 724 error_message = "\n" + '\n'.join( 725 [" " + line.strip() 726 for line in text_lines if line.strip()]) 727 raise Exception("Bug not created: %s" % error_message) 723 text_lines = BeautifulSoup(match.group('error_message')).findAll(text=True) 724 error_message = "\n" + '\n'.join([" " + line.strip() for line in text_lines if line.strip()]) 725 raise Exception("Bug not created: {}".format(error_message)) 728 726 729 727 def create_bug(self, -
trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py
r253230 r254382 365 365 366 366 title_html = b'<title>Attachment 317591 added to Bug 175247</title>' 367 self.assertEqual(bugzilla._parse_attachment_id_from_add_patch_to_bug_response(title_html), b'317591')367 self.assertEqual(bugzilla._parse_attachment_id_from_add_patch_to_bug_response(title_html), '317591') 368 368 369 369 title_html = b'<title>Attachment 317591; malformed</title>'
Note: See TracChangeset
for help on using the changeset viewer.