Ticket #8447: iterlists.2.diff

File iterlists.2.diff, 2.1 KB (added by James Turk, 16 years ago)

adds small documentation fix to patch

  • django/utils/datastructures.py

     
    278278        """Returns a list of (key, list) pairs."""
    279279        return super(MultiValueDict, self).items()
    280280
     281    def iterlists(self):
     282        """Yields (key, list) pairs."""
     283        return super(MultiValueDict, self).iteritems()
     284
    281285    def values(self):
    282286        """Returns a list of the last value on every key list."""
    283287        return [self[key] for key in self.keys()]
  • tests/regressiontests/datastructures/tests.py

     
    4444['Adrian', 'Simon']
    4545>>> list(d.iteritems())
    4646[('position', 'Developer'), ('name', 'Simon')]
     47>>> list(d.iterlists())
     48[('position', 'Developer'), ('name', ['Adrian', 'Simon'])]
    4749>>> d['lastname']
    4850Traceback (most recent call last):
    4951...
  • docs/request_response.txt

     
    278278           >>> q = QueryDict('a=1&a=2&a=3')
    279279           >>> q.items()
    280280           [('a', '3')]
     281           
     282    * ``iteritems()`` -- Just like the standard dictionary ``iteritems()``
     283      method.  Like ``items()`` this uses the same last-value logic as
     284      ``__getitem()__``.
    281285
    282286    * ``values()`` -- Just like the standard dictionary ``values()`` method,
    283287      except this uses the same last-value logic as ``__getitem()__``. For
     
    312316           >>> q = QueryDict('a=1&a=2&a=3')
    313317           >>> q.lists()
    314318           [('a', ['1', '2', '3'])]
     319           
     320    * ``iterlists()`` -- Like ``iteritems()`` except it includes all values,
     321      as a list, for each member of the dictionary.
    315322
    316323    * ``urlencode()`` -- Returns a string of the data in query-string format.
    317324      Example: ``"a=2&b=3&b=5"``.
Back to Top