summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
Diffstat (limited to 'django')
-rw-r--r--django/template/context.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/django/template/context.py b/django/template/context.py
index ba2c3d4d07..7a5ad161d4 100644
--- a/django/template/context.py
+++ b/django/template/context.py
@@ -145,11 +145,10 @@ class RenderContext(BaseContext):
return key in self.dicts[-1]
def get(self, key, otherwise=None):
- d = self.dicts[-1]
- if key in d:
- return d[key]
- return otherwise
+ return self.dicts[-1].get(key, otherwise)
+ def __getitem__(self, key):
+ return self.dicts[-1][key]
# This is a function rather than module-level procedural code because we only
# want it to execute if somebody uses RequestContext.