Skip to content

Commit

Permalink
Removed Context.has_key() method.
Browse files Browse the repository at this point in the history
  • Loading branch information
timgraham committed Jan 29, 2016
1 parent c47364e commit 09773f8
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions django/template/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,12 @@ def __delitem__(self, key):
"Delete a variable from the current context"
del self.dicts[-1][key]

def has_key(self, key):
def __contains__(self, key):
for d in self.dicts:
if key in d:
return True
return False

def __contains__(self, key):
return self.has_key(key)

def get(self, key, otherwise=None):
for d in reversed(self.dicts):
if key in d:
Expand Down Expand Up @@ -184,7 +181,7 @@ def __iter__(self):
for d in self.dicts[-1]:
yield d

def has_key(self, key):
def __contains__(self, key):
return key in self.dicts[-1]

def get(self, key, otherwise=None):
Expand Down

0 comments on commit 09773f8

Please sign in to comment.