Ticket #7331: 7331.diff

File 7331.diff, 1.1 KB (added by Jure Vrscaj, 16 years ago)

MultiValueDict.iteritems() patch with unittest

  • django/utils/datastructures.py

     
    266266        """
    267267        return [(key, self[key]) for key in self.keys()]
    268268
     269    def iteritems(self):
     270        """
     271        Yields (key, value) pairs, where value is the last item in
     272        the list associated with the key.
     273        """
     274        for key in self.keys():
     275            yield (key, self[key])
     276   
    269277    def lists(self):
    270278        """Returns a list of (key, list) pairs."""
    271279        return super(MultiValueDict, self).items()
  • tests/regressiontests/datastructures/tests.py

     
    4242'Simon'
    4343>>> d.getlist('name')
    4444['Adrian', 'Simon']
     45>>> list(d.iteritems())
     46[('position', 'Developer'), ('name', 'Simon')]
    4547>>> d['lastname']
    4648Traceback (most recent call last):
    4749...
Back to Top