Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #7331 -- Made `QueryDict.iteritems` behave like `QueryDict.item…

…s`, thanks jurev.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8399 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 2b82a3bcfc757c2bdafca6c5d9930201deed00cf 1 parent ddc156b
Gary Wilson Jr. authored August 16, 2008
8  django/utils/datastructures.py
@@ -266,6 +266,14 @@ def items(self):
266 266
         """
267 267
         return [(key, self[key]) for key in self.keys()]
268 268
 
  269
+    def iteritems(self):
  270
+        """
  271
+        Yields (key, value) pairs, where value is the last item in the list
  272
+        associated with the key.
  273
+        """
  274
+        for key in self.keys():
  275
+            yield (key, self[key])
  276
+
269 277
     def lists(self):
270 278
         """Returns a list of (key, list) pairs."""
271 279
         return super(MultiValueDict, self).items()
2  tests/regressiontests/datastructures/tests.py
@@ -42,6 +42,8 @@
42 42
 'Simon'
43 43
 >>> d.getlist('name')
44 44
 ['Adrian', 'Simon']
  45
+>>> list(d.iteritems())
  46
+[('position', 'Developer'), ('name', 'Simon')]
45 47
 >>> d['lastname']
46 48
 Traceback (most recent call last):
47 49
 ...

0 notes on commit 2b82a3b

Please sign in to comment.
Something went wrong with that request. Please try again.