Author: jacob
Date: 2009-03-31 17:02:37 -0500 (Tue, 31 Mar 2009)
New Revision: 10298

Modified:
   django/branches/releases/1.0.X/
   django/branches/releases/1.0.X/django/utils/datastructures.py
   django/branches/releases/1.0.X/docs/ref/request-response.txt
   django/branches/releases/1.0.X/tests/regressiontests/datastructures/tests.py
Log:
[1.0.X] Fixed #8847, #10370: added some missing methods to MultiValueDict after 
[8399]. Thanks, James Turk and rfk. Backport of r10241 from trunk.


Property changes on: django/branches/releases/1.0.X
___________________________________________________________________
Name: svnmerge-integrated
   - 
/django/trunk:1-9097,9099-9102,9104-9109,9111,9113-9144,9146-9151,9153-9156,9158-9159,9161-9187,9189-9247,9249-9262,9264-9277,9279-9298,9301-9302,9305-9331,9333-9343,9345,9347,9350-9352,9355-9396,9399-9462,9466-9469,9471-9488,9491-9526,9529,9533-9536,9539-9550,9556-9557,9559-9560,9562-9568,9570-9591,9595-9619,9621-9624,9626-9636,9638-9642,9644-9645,9647-9689,9691-9699,9703-9706,9709-9713,9716-9723,9725-9726,9730-9738,9740-9741,9750-9751,9757-9758,9761-9762,9767-9768,9770-9780,9782-9784,9789-9790,9793-9798,9801-9802,9806-9807,9809-9813,9821-9837,9842-9843,9847-9859,9861,9863-9875,9877-9881,9883-9887,9899-9903,9906-9909,9912,9914,9916-9917,9919-9920,9922-9927,9929,9931-9937,9939,9942-9943,9945-9950,9953-9954,9956-9962,9966-9977,9979-9984,9986-9988,9990,9992,9994,9996-9998,10003,10007,10009,10013,10015,10017,10022,10024,10031,10036-10037,10040,10049,10051,10054,10056-10058,10071,10073-10074,10078,10104,10125,10136,10139,10143,10145-10147,10149-10152,10170,10175,10193,10195-10196,10198-10221,10223-10228,10230-10234,10236-10240,10242-10247,10250-10257,10259-10270,10273-10274,10276-10277,10279,10282-10283
   + 
/django/trunk:1-9097,9099-9102,9104-9109,9111,9113-9144,9146-9151,9153-9156,9158-9159,9161-9187,9189-9247,9249-9262,9264-9277,9279-9298,9301-9302,9305-9331,9333-9343,9345,9347,9350-9352,9355-9396,9399-9462,9466-9469,9471-9488,9491-9526,9529,9533-9536,9539-9550,9556-9557,9559-9560,9562-9568,9570-9591,9595-9619,9621-9624,9626-9636,9638-9642,9644-9645,9647-9689,9691-9699,9703-9706,9709-9713,9716-9723,9725-9726,9730-9738,9740-9741,9750-9751,9757-9758,9761-9762,9767-9768,9770-9780,9782-9784,9789-9790,9793-9798,9801-9802,9806-9807,9809-9813,9821-9837,9842-9843,9847-9859,9861,9863-9875,9877-9881,9883-9887,9899-9903,9906-9909,9912,9914,9916-9917,9919-9920,9922-9927,9929,9931-9937,9939,9942-9943,9945-9950,9953-9954,9956-9962,9966-9977,9979-9984,9986-9988,9990,9992,9994,9996-9998,10003,10007,10009,10013,10015,10017,10022,10024,10031,10036-10037,10040,10049,10051,10054,10056-10058,10071,10073-10074,10078,10104,10125,10136,10139,10143,10145-10147,10149-10152,10170,10175,10193,10195-10196,10198-10221,10223-10228,10230-10234,10236-10247,10250-10257,10259-10270,10273-10274,10276-10277,10279,10282-10283

Modified: django/branches/releases/1.0.X/django/utils/datastructures.py
===================================================================
--- django/branches/releases/1.0.X/django/utils/datastructures.py       
2009-03-31 22:00:46 UTC (rev 10297)
+++ django/branches/releases/1.0.X/django/utils/datastructures.py       
2009-03-31 22:02:37 UTC (rev 10298)
@@ -294,10 +294,19 @@
         """Returns a list of (key, list) pairs."""
         return super(MultiValueDict, self).items()
 
+    def iterlists(self):
+        """Yields (key, list) pairs."""
+        return super(MultiValueDict, self).iteritems()
+
     def values(self):
         """Returns a list of the last value on every key list."""
         return [self[key] for key in self.keys()]
-
+        
+    def itervalues(self):
+        """Yield the last value on every key list."""
+        for key in self.iterkeys():
+            yield self[key]
+    
     def copy(self):
         """Returns a copy of this object."""
         return self.__deepcopy__()

Modified: django/branches/releases/1.0.X/docs/ref/request-response.txt
===================================================================
--- django/branches/releases/1.0.X/docs/ref/request-response.txt        
2009-03-31 22:00:46 UTC (rev 10297)
+++ django/branches/releases/1.0.X/docs/ref/request-response.txt        
2009-03-31 22:02:37 UTC (rev 10298)
@@ -14,11 +14,11 @@
 
 When a page is requested, Django creates an :class:`HttpRequest` object that
 contains metadata about the request. Then Django loads the appropriate view,
-passing the :class:`HttpRequest` as the first argument to the view function. 
Each
-view is responsible for returning an :class:`HttpResponse` object.
+passing the :class:`HttpRequest` as the first argument to the view function.
+Each view is responsible for returning an :class:`HttpResponse` object.
 
-This document explains the APIs for :class:`HttpRequest` and 
:class:`HttpResponse`
-objects.
+This document explains the APIs for :class:`HttpRequest` and
+:class:`HttpResponse` objects.
 
 HttpRequest objects
 ===================
@@ -103,7 +103,8 @@
         * ``read(num_bytes=None)`` -- Read a number of bytes from the file.
         * ``name`` -- The name of the uploaded file.
         * ``size`` -- The size, in bytes, of the uploaded file.
-        * ``chunks(chunk_size=None)`` -- A generator that yields sequential 
chunks of data.
+        * ``chunks(chunk_size=None)`` -- A generator that yields sequential
+          chunks of data.
 
     See :ref:`topics-files` for more information.
 
@@ -228,9 +229,10 @@
 
    .. versionadded:: 1.0
 
-   Returns ``True`` if the request was made via an ``XMLHttpRequest``, by 
checking
-   the ``HTTP_X_REQUESTED_WITH`` header for the string ``'XMLHttpRequest'``. 
The
-   following major JavaScript libraries all send this header:
+   Returns ``True`` if the request was made via an ``XMLHttpRequest``, by
+   checking the ``HTTP_X_REQUESTED_WITH`` header for the string
+   ``'XMLHttpRequest'``. The following major JavaScript libraries all send this
+   header:
 
        * jQuery
        * Dojo
@@ -316,7 +318,18 @@
            >>> q = QueryDict('a=1&a=2&a=3')
            >>> q.items()
            [('a', '3')]
+           
+.. method:: QueryDict.iteritems()
 
+    Just like the standard dictionary ``iteritems()`` method. Like
+    :meth:`QueryDict.items()` this uses the same last-value logic as
+    :meth:`QueryDict.__getitem()__`.
+
+.. method:: QueryDict.iterlists()
+
+    Like :meth:`QueryDict.iteritems()` except it includes all values, as a 
list,
+    for each member of the dictionary.
+
 .. method:: QueryDict.values()
 
     Just like the standard dictionary ``values()`` method, except this uses the
@@ -326,6 +339,10 @@
            >>> q.values()
            ['3']
 
+.. method:: QueryDict.itervalues()
+
+    Just like :meth:`QueryDict.values()`, except an iterator.
+
 In addition, ``QueryDict`` has the following methods:
 
 .. method:: QueryDict.copy()

Modified: 
django/branches/releases/1.0.X/tests/regressiontests/datastructures/tests.py
===================================================================
--- 
django/branches/releases/1.0.X/tests/regressiontests/datastructures/tests.py    
    2009-03-31 22:00:46 UTC (rev 10297)
+++ 
django/branches/releases/1.0.X/tests/regressiontests/datastructures/tests.py    
    2009-03-31 22:02:37 UTC (rev 10298)
@@ -45,6 +45,8 @@
 ['Adrian', 'Simon']
 >>> list(d.iteritems())
 [('position', 'Developer'), ('name', 'Simon')]
+>>> list(d.iterlists())
+[('position', ['Developer']), ('name', ['Adrian', 'Simon'])]
 >>> d['lastname']
 Traceback (most recent call last):
 ...
@@ -58,6 +60,10 @@
 >>> d.setlist('lastname', ['Holovaty', 'Willison'])
 >>> d.getlist('lastname')
 ['Holovaty', 'Willison']
+>>> d.values() 
+['Developer', 'Simon', 'Willison']
+>>> list(d.itervalues()) 
+['Developer', 'Simon', 'Willison']
 
 ### SortedDict 
#################################################################
 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to