Loading AUTHORS +1 −0 Original line number Diff line number Diff line Loading @@ -195,6 +195,7 @@ answer newbie questions, and generally made Django that much better: Sung-Jin Hong <serialx.net@gmail.com> Richard House <Richard.House@i-logue.com> Robert Rock Howard <http://djangomojo.com/> John Huddleston <huddlej@wwu.edu> Rob Hudson <http://rob.cogit8.org/> Jason Huggins <http://www.jrandolph.com/blog/> Hyun Mi Ae Loading django/utils/datastructures.py +5 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,11 @@ class SortedDict(dict): """ A dictionary that keeps its keys in the order in which they're inserted. """ def __new__(cls, *args, **kwargs): instance = super(SortedDict, cls).__new__(cls, *args, **kwargs) instance.keyOrder = [] return instance def __init__(self, data=None): if data is None: data = {} Loading tests/regressiontests/datastructures/tests.py +6 −2 Original line number Diff line number Diff line """ # Tests for stuff in django.utils.datastructures. >>> import pickle >>> from django.utils.datastructures import * ### MergeDict ################################################################# Loading Loading @@ -103,13 +104,16 @@ Init from sequence of tuples >>> print repr(d) {1: 'one', 0: 'zero', 2: 'two'} >>> pickle.loads(pickle.dumps(d, 2)) {1: 'one', 0: 'zero', 2: 'two'} >>> d.clear() >>> d {} >>> d.keyOrder [] ### DotExpandedDict ############################################################ ### DotExpandedDict ########################################################## >>> d = DotExpandedDict({'person.1.firstname': ['Simon'], 'person.1.lastname': ['Willison'], 'person.2.firstname': ['Adrian'], 'person.2.lastname': ['Holovaty']}) >>> d['person']['1']['lastname'] Loading @@ -119,7 +123,7 @@ Init from sequence of tuples >>> d['person']['2']['firstname'] ['Adrian'] ### ImmutableList ################################################################ ### ImmutableList ############################################################ >>> d = ImmutableList(range(10)) >>> d.sort() Traceback (most recent call last): Loading Loading
AUTHORS +1 −0 Original line number Diff line number Diff line Loading @@ -195,6 +195,7 @@ answer newbie questions, and generally made Django that much better: Sung-Jin Hong <serialx.net@gmail.com> Richard House <Richard.House@i-logue.com> Robert Rock Howard <http://djangomojo.com/> John Huddleston <huddlej@wwu.edu> Rob Hudson <http://rob.cogit8.org/> Jason Huggins <http://www.jrandolph.com/blog/> Hyun Mi Ae Loading
django/utils/datastructures.py +5 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,11 @@ class SortedDict(dict): """ A dictionary that keeps its keys in the order in which they're inserted. """ def __new__(cls, *args, **kwargs): instance = super(SortedDict, cls).__new__(cls, *args, **kwargs) instance.keyOrder = [] return instance def __init__(self, data=None): if data is None: data = {} Loading
tests/regressiontests/datastructures/tests.py +6 −2 Original line number Diff line number Diff line """ # Tests for stuff in django.utils.datastructures. >>> import pickle >>> from django.utils.datastructures import * ### MergeDict ################################################################# Loading Loading @@ -103,13 +104,16 @@ Init from sequence of tuples >>> print repr(d) {1: 'one', 0: 'zero', 2: 'two'} >>> pickle.loads(pickle.dumps(d, 2)) {1: 'one', 0: 'zero', 2: 'two'} >>> d.clear() >>> d {} >>> d.keyOrder [] ### DotExpandedDict ############################################################ ### DotExpandedDict ########################################################## >>> d = DotExpandedDict({'person.1.firstname': ['Simon'], 'person.1.lastname': ['Willison'], 'person.2.firstname': ['Adrian'], 'person.2.lastname': ['Holovaty']}) >>> d['person']['1']['lastname'] Loading @@ -119,7 +123,7 @@ Init from sequence of tuples >>> d['person']['2']['firstname'] ['Adrian'] ### ImmutableList ################################################################ ### ImmutableList ############################################################ >>> d = ImmutableList(range(10)) >>> d.sort() Traceback (most recent call last): Loading