Created
May 31, 2010 11:02
-
-
Save qoelet/419738 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def apply_extra_context(extra_context, context): | |
""" | |
Adds items from extra_context dict to context. If a value in extra_context | |
is callable, then it is called and the result is added to context. | |
""" | |
for key, value in extra_context.iteritems(): | |
if callable(value): | |
context[key] = value() | |
else: | |
context[key] = value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment