Django

Code

Changeset 6751

Show
Ignore:
Timestamp:
11/29/07 14:09:54 (1 year ago)
Author:
mtredinnick
Message:

Fixed #6050 -- Handled edge-case of duplicate keys being passed when
initialising SortedDict. Patch from Collin Grady and SmileyChris?.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/utils/datastructures.py

    r6714 r6751  
    6161            self.keyOrder = data.keys() 
    6262        else: 
    63             self.keyOrder = [key for key, value in data] 
     63            self.keyOrder = [] 
     64            for key, value in data: 
     65                if key not in self.keyOrder: 
     66                    self.keyOrder.append(key) 
    6467 
    6568    def __deepcopy__(self, memo): 
  • django/trunk/tests/regressiontests/utils/tests.py

    r6569 r6751  
    77from django.utils import html, checksums 
    88 
    9 from timesince import timesince_tests 
     9import timesince 
     10import datastructures 
     11 
     12# Extra tests 
     13__test__ = { 
     14    'timesince': timesince, 
     15    'datastructures': datastructures, 
     16
    1017 
    1118class TestUtilsHtml(TestCase): 
     
    143150            self.check_output(f, value, output) 
    144151 
    145 __test__ = { 
    146     'timesince_tests': timesince_tests, 
    147 } 
    148  
    149152if __name__ == "__main__": 
    150153    import doctest 
  • django/trunk/tests/regressiontests/utils/timesince.py

    r6366 r6751  
    1 timesince_tests = """ 
     1""" 
    22>>> from datetime import datetime, timedelta 
    33>>> from django.utils.timesince import timesince