Created
October 18, 2010 09:42
-
-
Save kasima/631977 to your computer and use it in GitHub Desktop.
Favorite piece of code I wrote last week
This file contains 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
# double closures - what does it mean!? | |
def if_braintree_disabled(default): | |
def generate_decorator(f): | |
def decorator(*args, **kwargs): | |
if not settings.LIVE_SITE and not settings.BRAINTREE_ENABLED: | |
return default | |
else: | |
return f(*args, **kwargs) | |
return decorator | |
return generate_decorator |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment