From 701faf0d16584a7c38bd0ba9f9ae778ca9912dbe Mon Sep 17 00:00:00 2001
From: Victor Stinner <victor.stinner@enovance.com>
Date: Mon, 24 Mar 2014 18:21:34 +0100
Subject: [PATCH] Replace dict.iteritems() with dict.items()

dict.iteritems() has been removed in Python 3. In Python 2, dict.items()
creates a temporary list, but Samuel Merritt wrote:

"The size of the data is small enough that we don't need to worry about the
memory consumption; it's all just HTTP headers."

Change-Id: Iac427b8bbd032e4a1efb2bdc84a3968217eb6ddf
---
 swiftclient/client.py     | 6 +++---
 tests/test_swiftclient.py | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/swiftclient/client.py b/swiftclient/client.py
index 72dac8d9..ad778175 100644
--- a/swiftclient/client.py
+++ b/swiftclient/client.py
@@ -105,7 +105,7 @@ def quote(value, safe='/'):
 
 def validate_headers(headers):
     if headers:
-        for key, raw_value in headers.iteritems():
+        for key, raw_value in headers.items():
             value = str(encode_utf8(raw_value))
 
             if '\n' in value:
@@ -179,7 +179,7 @@ class HTTPConnection:
     def request(self, method, full_path, data=None, headers={}, files=None):
         """ Encode url and header, then call requests.request """
         headers = dict((encode_utf8(x), encode_utf8(y)) for x, y in
-                       headers.iteritems())
+                       headers.items())
         url = encode_utf8("%s://%s%s" % (
             self.parsed_url.scheme,
             self.parsed_url.netloc,
@@ -911,7 +911,7 @@ def put_object(url, token=None, container=None, name=None, contents=None,
     if content_length is not None:
         headers['Content-Length'] = str(content_length)
     else:
-        for n, v in headers.iteritems():
+        for n, v in headers.items():
             if n.lower() == 'content-length':
                 content_length = int(v)
     if content_type is not None:
diff --git a/tests/test_swiftclient.py b/tests/test_swiftclient.py
index b57bf9f6..8f709472 100644
--- a/tests/test_swiftclient.py
+++ b/tests/test_swiftclient.py
@@ -168,7 +168,7 @@ class MockHttpResponse():
         self.status = 200
         # This simulate previous httplib implementation that would do a
         # putrequest() and then use putheader() to send header.
-        for k, v in kwarg['headers'].iteritems():
+        for k, v in kwarg['headers'].items():
             self.buffer.append('%s: %s' % (k, v))
         return self.fake_response()