mirror of https://github.com/django/django.git
In `MergeDict` class, changed variable names to not clash with `dict` builtin.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6711 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
dab8503146
commit
8df3d2b467
|
@ -7,9 +7,9 @@ class MergeDict(object):
|
||||||
self.dicts = dicts
|
self.dicts = dicts
|
||||||
|
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
for dict in self.dicts:
|
for dict_ in self.dicts:
|
||||||
try:
|
try:
|
||||||
return dict[key]
|
return dict_[key]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
raise KeyError
|
raise KeyError
|
||||||
|
@ -24,22 +24,22 @@ class MergeDict(object):
|
||||||
return default
|
return default
|
||||||
|
|
||||||
def getlist(self, key):
|
def getlist(self, key):
|
||||||
for dict in self.dicts:
|
for dict_ in self.dicts:
|
||||||
try:
|
try:
|
||||||
return dict.getlist(key)
|
return dict_.getlist(key)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
raise KeyError
|
raise KeyError
|
||||||
|
|
||||||
def items(self):
|
def items(self):
|
||||||
item_list = []
|
item_list = []
|
||||||
for dict in self.dicts:
|
for dict_ in self.dicts:
|
||||||
item_list.extend(dict.items())
|
item_list.extend(dict_.items())
|
||||||
return item_list
|
return item_list
|
||||||
|
|
||||||
def has_key(self, key):
|
def has_key(self, key):
|
||||||
for dict in self.dicts:
|
for dict_ in self.dicts:
|
||||||
if key in dict:
|
if key in dict_:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -114,8 +114,8 @@ class SortedDict(dict):
|
||||||
for key in self.keyOrder:
|
for key in self.keyOrder:
|
||||||
yield dict.__getitem__(self, key)
|
yield dict.__getitem__(self, key)
|
||||||
|
|
||||||
def update(self, dict):
|
def update(self, dict_):
|
||||||
for k, v in dict.items():
|
for k, v in dict_.items():
|
||||||
self.__setitem__(k, v)
|
self.__setitem__(k, v)
|
||||||
|
|
||||||
def setdefault(self, key, default):
|
def setdefault(self, key, default):
|
||||||
|
|
Loading…
Reference in New Issue