Changeset 100592 in webkit
- Timestamp:
- Nov 17, 2011 3:01:53 AM (12 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r100591 r100592 1 2011-11-17 Adam Barth <abarth@webkit.org> 2 3 Move test_results_uploader.py out of layout_package 4 https://bugs.webkit.org/show_bug.cgi?id=72590 5 6 Reviewed by Eric Seidel. 7 8 Most of the lines of code in this file are wrong, but I've restrained 9 myself and only changed a few of them to generalized this class to the 10 common package. 11 12 This is part of a series of patches to remove layout_package. 13 14 * Scripts/webkitpy/common/net/file_uploader.py: Copied from Tools/Scripts/webkitpy/layout_tests/layout_package/test_results_uploader.py. 15 * Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py: 16 * Scripts/webkitpy/layout_tests/layout_package/test_results_uploader.py: Removed. 17 1 18 2011-11-17 Adam Barth <abarth@webkit.org> 2 19 -
trunk/Tools/Scripts/webkitpy/common/net/file_uploader.py
r100591 r100592 37 37 from webkitpy.common.net.networktransaction import NetworkTransaction 38 38 39 39 40 def get_mime_type(filename): 40 41 return mimetypes.guess_type(filename)[0] or 'application/octet-stream' 41 42 42 43 44 # FIXME: Rather than taking tuples, this function should take more structured data. 43 45 def _encode_multipart_form_data(fields, files): 44 46 """Encode form fields for multipart/form-data. … … 82 84 83 85 84 class TestResultsUploader:85 def __init__(self, host):86 self._ host = host86 class FileUploader(object): 87 def __init__(self, url): 88 self._url = url 87 89 88 90 def _upload_files(self, attrs, file_objs): 89 url = "http://%s/testfile/upload" % self._host91 # FIXME: We should use the same variable names for the formal and actual parameters. 90 92 content_type, data = _encode_multipart_form_data(attrs, file_objs) 91 headers = {"Content-Type": content_type} 92 request = urllib2.Request(url, data, headers) 93 headers = { 94 "Content-Type": content_type, 95 } 96 # FIXME: We should talk to the network via a Host object. 97 request = urllib2.Request(self._url, data, headers) 93 98 urllib2.urlopen(request) 94 99 … … 96 101 file_objs = [] 97 102 for filename, path in files: 103 # FIXME: We should talk to the filesytem via a Host object. 98 104 with codecs.open(path, "rb") as file: 99 105 file_objs.append(('file', filename, file.read())) … … 101 107 orig_timeout = socket.getdefaulttimeout() 102 108 try: 109 # FIXME: We shouldn't mutate global static state. 103 110 socket.setdefaulttimeout(timeout_seconds) 104 111 NetworkTransaction(timeout_seconds=timeout_seconds).run( -
trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator.py
r91214 r100592 35 35 import xml.dom.minidom 36 36 37 from webkitpy. layout_tests.layout_package import test_results_uploader37 from webkitpy.common.net.file_uploader import FileUploader 38 38 39 39 try: … … 318 318 for file in json_files] 319 319 320 u ploader = test_results_uploader.TestResultsUploader(321 self._test_results_server)320 url = "http://%s/testfile/upload" % self._test_results_server 321 uploader = FileUploader(url) 322 322 try: 323 323 # Set uploading timeout in case appengine server is having problem. … … 419 419 420 420 try: 421 # FIXME: We should talk to the network via a Host object. 421 422 results_file = urllib2.urlopen(results_file_url) 422 423 info = results_file.info()
Note: See TracChangeset
for help on using the changeset viewer.