diff options
author | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2013-08-21 15:38:32 -0700 |
---|---|---|
committer | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2013-08-21 15:38:32 -0700 |
commit | 41fdc80a3d4867c03db10794f0d24e95acc8faa3 (patch) | |
tree | 21b8df051b7de90c218505387ba472773478ba7d | |
parent | e40bbc1851d5c087f78a05cb0bf74f129d16c3a9 (diff) | |
download | pyscss-41fdc80a3d4867c03db10794f0d24e95acc8faa3.tar.gz |
Enforce that Sass functions return Sass values.
-rw-r--r-- | scss/expression.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/scss/expression.py b/scss/expression.py index fe8a045..91a164e 100644 --- a/scss/expression.py +++ b/scss/expression.py @@ -11,7 +11,7 @@ import scss.config as config from scss.cssdefs import COLOR_NAMES, is_builtin_css_function, _expr_glob_re, _interpolate_re, _variable_re from scss.errors import SassError, SassEvaluationError, SassParseError from scss.rule import Namespace -from scss.types import Boolean, Color, List, Map, Null, Number, ParserValue, String, Undefined +from scss.types import Boolean, Color, List, Map, Null, Number, ParserValue, String, Undefined, Value from scss.util import dequote, normalize_var ################################################################################ @@ -310,7 +310,10 @@ class CallOp(Expression): log.error("Function not found: %s:%s", func_name, argspec_len, extra={'stack': True}) raise if funct: - return funct(*args, **kwargs) + ret = funct(*args, **kwargs) + if not isinstance(ret, Value): + raise TypeError("Expected Sass type as return value, got %r" % (ret,)) + return ret rendered_args = [] for var, value in evald_argpairs: |