Merge lp:~gholt/swift/utfdash8 into lp:~hudson-openstack/swift/trunk

Proposed by gholt
Status: Merged
Approved by: David Goetz
Approved revision: 310
Merged at revision: 310
Proposed branch: lp:~gholt/swift/utfdash8
Merge into: lp:~hudson-openstack/swift/trunk
Diff against target: 168 lines (+18/-12)
6 files modified
swift/account/server.py (+1/-1)
swift/container/server.py (+1/-1)
test/functional/tests.py (+4/-4)
test/unit/account/test_server.py (+3/-0)
test/unit/common/middleware/test_staticweb.py (+6/-6)
test/unit/container/test_server.py (+3/-0)
To merge this branch: bzr merge lp:~gholt/swift/utfdash8
Reviewer Review Type Date Requested Status
David Goetz (community) Approve
John Dickinson Approve
Review via email: mp+64236@code.launchpad.net

Description of the change

Fixed account and container listings so they return with charset=utf-8 instead of utf8.

To post a comment you must log in.
lp:~gholt/swift/utfdash8 updated
310. By gholt

Update staticweb generated test data to match utf-8 update

Revision history for this message
John Dickinson (notmyname) wrote :

looks fine

review: Approve
Revision history for this message
David Goetz (david-goetz) wrote :

looks good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'swift/account/server.py'
2--- swift/account/server.py 2011-05-27 23:31:58 +0000
3+++ swift/account/server.py 2011-06-10 19:34:35 +0000
4@@ -244,7 +244,7 @@
5 account_list = '\n'.join(r[0] for r in account_list) + '\n'
6 ret = Response(body=account_list, request=req, headers=resp_headers)
7 ret.content_type = out_content_type
8- ret.charset = 'utf8'
9+ ret.charset = 'utf-8'
10 return ret
11
12 def REPLICATE(self, req):
13
14=== modified file 'swift/container/server.py'
15--- swift/container/server.py 2011-05-27 23:31:58 +0000
16+++ swift/container/server.py 2011-06-10 19:34:35 +0000
17@@ -334,7 +334,7 @@
18 container_list = '\n'.join(r[0] for r in container_list) + '\n'
19 ret = Response(body=container_list, request=req, headers=resp_headers)
20 ret.content_type = out_content_type
21- ret.charset = 'utf8'
22+ ret.charset = 'utf-8'
23 return ret
24
25 def REPLICATE(self, req):
26
27=== modified file 'test/functional/tests.py'
28--- test/functional/tests.py 2011-02-24 22:21:14 +0000
29+++ test/functional/tests.py 2011-06-10 19:34:35 +0000
30@@ -227,10 +227,10 @@
31 headers = dict(self.env.conn.response.getheaders())
32 if format == 'json':
33 self.assertEquals(headers['content-type'],
34- 'application/json; charset=utf8')
35+ 'application/json; charset=utf-8')
36 elif format == 'xml':
37 self.assertEquals(headers['content-type'],
38- 'application/xml; charset=utf8')
39+ 'application/xml; charset=utf-8')
40
41 def testListingLimit(self):
42 limit = 10000
43@@ -1355,10 +1355,10 @@
44 headers = dict(self.env.conn.response.getheaders())
45 if format == 'json':
46 self.assertEquals(headers['content-type'],
47- 'application/json; charset=utf8')
48+ 'application/json; charset=utf-8')
49 elif format == 'xml':
50 self.assertEquals(headers['content-type'],
51- 'application/xml; charset=utf8')
52+ 'application/xml; charset=utf-8')
53
54 lm_diff = max([f['last_modified'] for f in files]) - \
55 min([f['last_modified'] for f in files])
56
57=== modified file 'test/unit/account/test_server.py'
58--- test/unit/account/test_server.py 2011-01-04 23:34:43 +0000
59+++ test/unit/account/test_server.py 2011-06-10 19:34:35 +0000
60@@ -388,6 +388,7 @@
61 self.assertEquals(resp.status_int, 200)
62 self.assertEquals(resp.body.strip().split('\n'), ['c1', 'c2'])
63 self.assertEquals(resp.content_type, 'text/plain')
64+ self.assertEquals(resp.charset, 'utf-8')
65
66 def test_GET_with_containers_json(self):
67 req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'PUT',
68@@ -436,6 +437,7 @@
69 [{'count': 1, 'bytes': 2, 'name': 'c1'},
70 {'count': 3, 'bytes': 4, 'name': 'c2'}])
71 self.assertEquals(resp.content_type, 'application/json')
72+ self.assertEquals(resp.charset, 'utf-8')
73
74 def test_GET_with_containers_xml(self):
75 req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'PUT',
76@@ -529,6 +531,7 @@
77 self.assertEquals(node.firstChild.nodeValue, '3')
78 node = [n for n in container if n.nodeName == 'bytes'][0]
79 self.assertEquals(node.firstChild.nodeValue, '4')
80+ self.assertEquals(resp.charset, 'utf-8')
81
82 def test_GET_limit_marker_plain(self):
83 req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'PUT',
84
85=== modified file 'test/unit/common/middleware/test_staticweb.py'
86--- test/unit/common/middleware/test_staticweb.py 2011-03-25 20:22:04 +0000
87+++ test/unit/common/middleware/test_staticweb.py 2011-06-10 19:34:35 +0000
88@@ -187,7 +187,7 @@
89 headers.update({'X-Container-Object-Count': '11',
90 'X-Container-Bytes-Used': '73741',
91 'X-Container-Read': '.r:*',
92- 'Content-Type': 'application/json; charset=utf8'})
93+ 'Content-Type': 'application/json; charset=utf-8'})
94 body = '''
95 [{"name":"subdir/1.txt",
96 "hash":"5f595114a4b3077edfac792c61ca4fe4", "bytes":20,
97@@ -204,14 +204,14 @@
98 headers.update({'X-Container-Object-Count': '11',
99 'X-Container-Bytes-Used': '73741',
100 'X-Container-Read': '.r:*',
101- 'Content-Type': 'application/json; charset=utf8'})
102+ 'Content-Type': 'application/json; charset=utf-8'})
103 body = '[]'
104 elif env['PATH_INFO'] == '/v1/a/c3' and env['QUERY_STRING'] == \
105 'limit=1&format=json&delimiter=/&limit=1&prefix=subdirz/':
106 headers.update({'X-Container-Object-Count': '11',
107 'X-Container-Bytes-Used': '73741',
108 'X-Container-Read': '.r:*',
109- 'Content-Type': 'application/json; charset=utf8'})
110+ 'Content-Type': 'application/json; charset=utf-8'})
111 body = '''
112 [{"name":"subdirz/1.txt",
113 "hash":"5f595114a4b3077edfac792c61ca4fe4", "bytes":20,
114@@ -224,7 +224,7 @@
115 'X-Container-Bytes-Used': '73741',
116 'X-Container-Read': '.r:*',
117 'X-Container-Web-Listings': 't',
118- 'Content-Type': 'application/json; charset=utf8'})
119+ 'Content-Type': 'application/json; charset=utf-8'})
120 body = '''
121 [{"name":"subdir/1.txt",
122 "hash":"5f595114a4b3077edfac792c61ca4fe4", "bytes":20,
123@@ -236,7 +236,7 @@
124 elif 'format=json' in env['QUERY_STRING']:
125 headers.update({'X-Container-Object-Count': '11',
126 'X-Container-Bytes-Used': '73741',
127- 'Content-Type': 'application/json; charset=utf8'})
128+ 'Content-Type': 'application/json; charset=utf-8'})
129 body = '''
130 [{"name":"401error.html",
131 "hash":"893f8d80692a4d3875b45be8f152ad18", "bytes":110,
132@@ -283,7 +283,7 @@
133 else:
134 headers.update({'X-Container-Object-Count': '11',
135 'X-Container-Bytes-Used': '73741',
136- 'Content-Type': 'text/plain; charset=utf8'})
137+ 'Content-Type': 'text/plain; charset=utf-8'})
138 body = '\n'.join(['401error.html', '404error.html', 'index.html',
139 'listing.css', 'one.txt', 'subdir/1.txt',
140 'subdir/2.txt', 'subdir/omgomg.txt', 'subdir2',
141
142=== modified file 'test/unit/container/test_server.py'
143--- test/unit/container/test_server.py 2011-05-19 06:59:47 +0000
144+++ test/unit/container/test_server.py 2011-06-10 19:34:35 +0000
145@@ -514,6 +514,7 @@
146 resp = self.controller.GET(req)
147 self.assertEquals(resp.content_type, 'application/json')
148 self.assertEquals(eval(resp.body), json_body)
149+ self.assertEquals(resp.charset, 'utf-8')
150
151 for accept in ('application/json', 'application/json;q=1.0,*/*;q=0.9',
152 '*/*;q=0.9,application/json;q=1.0', 'application/*'):
153@@ -552,6 +553,7 @@
154 resp = self.controller.GET(req)
155 self.assertEquals(resp.content_type, 'text/plain')
156 self.assertEquals(resp.body, plain_body)
157+ self.assertEquals(resp.charset, 'utf-8')
158
159 for accept in ('', 'text/plain', 'application/xml;q=0.8,*/*;q=0.9',
160 '*/*;q=0.9,application/xml;q=0.8', '*/*',
161@@ -609,6 +611,7 @@
162 resp = self.controller.GET(req)
163 self.assertEquals(resp.content_type, 'application/xml')
164 self.assertEquals(resp.body, xml_body)
165+ self.assertEquals(resp.charset, 'utf-8')
166
167 for xml_accept in ('application/xml', 'application/xml;q=1.0,*/*;q=0.9',
168 '*/*;q=0.9,application/xml;q=1.0', 'application/xml,text/xml'):