summaryrefslogtreecommitdiff
path: root/django/template/context.py
diff options
context:
space:
mode:
authorChristopher Long <indirecthit@gmail.com>2007-06-17 22:18:54 +0000
committerChristopher Long <indirecthit@gmail.com>2007-06-17 22:18:54 +0000
commitae22b6d403dcf25098c77f0dfcf59ae58b186461 (patch)
treec37fc631e99a7e4d909d6b6d236f495003731ea7 /django/template/context.py
parent0cf7bc439129c66df8d64601e885f83b256b4f25 (diff)
per-object-permissions: Merged to trunk [5486] NOTE: Not fully tested, will be working on this over the next few weeks.
git-svn-id: http://code.djangoproject.com/svn/django/branches/per-object-permissions@5488 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/template/context.py')
-rw-r--r--django/template/context.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/django/template/context.py b/django/template/context.py
index ba23e95ab7..59650b05fe 100644
--- a/django/template/context.py
+++ b/django/template/context.py
@@ -35,7 +35,7 @@ class Context(object):
def __getitem__(self, key):
"Get a variable's value, starting at the current context and going upward"
for d in self.dicts:
- if d.has_key(key):
+ if key in d:
return d[key]
raise KeyError(key)
@@ -45,13 +45,16 @@ class Context(object):
def has_key(self, key):
for d in self.dicts:
- if d.has_key(key):
+ 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 self.dicts:
- if d.has_key(key):
+ if key in d:
return d[key]
return otherwise