diff options
| author | German M. Bravo <german.mb@deipi.com> | 2013-09-27 13:14:14 -0500 |
|---|---|---|
| committer | German M. Bravo <german.mb@deipi.com> | 2013-09-27 13:20:19 -0500 |
| commit | 846e479e22090e779a483217b60803f167d5ce46 (patch) | |
| tree | 695a26abbb580625aaa349ce05635bfc551d7cf9 | |
| parent | 275e67c71987bf3290e347461b9899a0bd192861 (diff) | |
| download | pyscss-846e479e22090e779a483217b60803f167d5ce46.tar.gz | |
FATAL_UNDEFINED moved to config (some may need undefined variables to be not fatal)
| -rw-r--r-- | scss/config.py | 1 | ||||
| -rw-r--r-- | scss/expression.py | 12 |
2 files changed, 7 insertions, 6 deletions
diff --git a/scss/config.py b/scss/config.py index 345307e..2ef93ac 100644 --- a/scss/config.py +++ b/scss/config.py @@ -15,6 +15,7 @@ CACHE_ROOT = None STATIC_URL = 'static/' ASSETS_URL = 'static/assets/' VERBOSITY = 1 +FATAL_UNDEFINED = True DEBUG = 0 SPRTE_MAP_DIRECTION = 'vertical' diff --git a/scss/expression.py b/scss/expression.py index ce96dea..4c521c6 100644 --- a/scss/expression.py +++ b/scss/expression.py @@ -24,8 +24,6 @@ except ImportError: log = logging.getLogger(__name__) -FATAL_UNDEFINED = True - class Calculator(object): """Expression evaluator.""" @@ -74,10 +72,11 @@ class Calculator(object): try: v = self.namespace.variable(n) except KeyError: - if FATAL_UNDEFINED: + if config.FATAL_UNDEFINED: raise else: - log.error("Undefined variable '%s'", n, extra={'stack': True}) + if config.VERBOSITY > 1: + log.error("Undefined variable '%s'", n, extra={'stack': True}) return n else: if v: @@ -352,10 +351,11 @@ class Variable(Expression): try: value = calculator.namespace.variable(self.name) except KeyError: - if FATAL_UNDEFINED: + if config.FATAL_UNDEFINED: raise else: - log.error("Undefined variable '%s'", self.name, extra={'stack': True}) + if config.VERBOSITY > 1: + log.error("Undefined variable '%s'", self.name, extra={'stack': True}) return Undefined() else: if isinstance(value, six.string_types): |
