diff options
author | Eevee <eevee.git@veekun.com> | 2013-05-22 16:11:21 -0700 |
---|---|---|
committer | Eevee <eevee.git@veekun.com> | 2013-05-23 13:43:25 -0700 |
commit | d7f42760f61cde2d039b5f9494dda832b2fb560e (patch) | |
tree | 1007a3dc753fe538e917a79f9a20d846a5031c71 /scss/expression.py | |
parent | 112dbe27ea5881f9da7c5d18273ee842ab29012d (diff) | |
download | pyscss-d7f42760f61cde2d039b5f9494dda832b2fb560e.tar.gz |
Break functions and mixins out of rule.options.
Also introduces ChainMap, used for scoping instead of options, and
subclasses it to build in the variable name normalization.
Diffstat (limited to 'scss/expression.py')
-rw-r--r-- | scss/expression.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/scss/expression.py b/scss/expression.py index b404a2c..8b20712 100644 --- a/scss/expression.py +++ b/scss/expression.py @@ -251,13 +251,14 @@ class CallOp(Expression): num_args = len(self.argspec.argpairs) - # First look for a custom in-sass function - option_name = "@function %s:%d" % (name, num_args) - func = rule.options.get(option_name) - # @functions take a rule as first arg. TODO: Python functions possibly - # should too - if func is not None: + # TODO merge this with the library + try: + func = rule.functions[name, num_args] + # @functions take a rule as first arg. TODO: Python functions possibly + # should too func = partial(func, rule) + except KeyError: + func = None try: # If that fails, check for Python implementations |