#NEWLINE# def run_if( * args ) : #NEWLINE# #INDENT# "\n    Decorator prevents function run if required feature flag is False and\n    raises exception if it doesn't exist.\n    " #NEWLINE# feature_flags = feature_flags #NEWLINE# def require_settings_decorator( func ) : #NEWLINE# #INDENT# def wrapper( * args , **kwargs ) : #NEWLINE# #INDENT# for flag in feature_flags : #NEWLINE# #INDENT# flag_value = getattr ( settings , flag , None ) #NEWLINE# if ( not isinstance ( flag_value , bool ) ) : #NEWLINE# #INDENT# raise Exception ( 'Setting {} must be either True or False.' . format ( flag ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not flag_value ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return func ( * args , ** kwargs ) #NEWLINE# #UNINDENT# return wrapper #NEWLINE# #UNINDENT# return require_settings_decorator