Merge lp:~deeptik/linaro-fetch-image/add-license-accept into lp:~dooferlad/linaro-fetch-image/add-license-accept

Proposed by Deepti B. Kalakeri
Status: Merged
Merged at revision: 11
Proposed branch: lp:~deeptik/linaro-fetch-image/add-license-accept
Merge into: lp:~dooferlad/linaro-fetch-image/add-license-accept
Diff against target: 37 lines (+14/-13)
1 file modified
linaro_fetch_image/license_protected_file_downloader.py (+14/-13)
To merge this branch: bzr merge lp:~deeptik/linaro-fetch-image/add-license-accept
Reviewer Review Type Date Requested Status
James Tunnicliffe Pending
Review via email: mp+104725@code.launchpad.net

Description of the change

Fix parsing of header.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'linaro_fetch_image/license_protected_file_downloader.py'
2--- linaro_fetch_image/license_protected_file_downloader.py 2012-05-04 11:05:10 +0000
3+++ linaro_fetch_image/license_protected_file_downloader.py 2012-05-04 12:27:19 +0000
4@@ -68,19 +68,20 @@
5
6 # The location attribute is sometimes relative, but we would
7 # like to have it as always absolute...
8- parsed_location = urlparse.urlparse(header["Location"])
9-
10- # If not an absolute location...
11- if not parsed_location.netloc:
12- parsed_source_url = urlparse.urlparse(url)
13- new_location = ["", "", "", "", ""]
14-
15- new_location[0] = parsed_source_url.scheme
16- new_location[1] = parsed_source_url.netloc
17- new_location[2] = header["Location"]
18-
19- # Update location with absolute URL
20- header["Location"] = urlparse.urlunsplit(new_location)
21+ if 'Location' in header.keys():
22+ parsed_location = urlparse.urlparse(header["Location"])
23+
24+ # If not an absolute location...
25+ if not parsed_location.netloc:
26+ parsed_source_url = urlparse.urlparse(url)
27+ new_location = ["", "", "", "", ""]
28+
29+ new_location[0] = parsed_source_url.scheme
30+ new_location[1] = parsed_source_url.netloc
31+ new_location[2] = header["Location"]
32+
33+ # Update location with absolute URL
34+ header["Location"] = urlparse.urlunsplit(new_location)
35
36 self.header_text = self.header
37 self.header = header

Subscribers

People subscribed via source and target branches