summaryrefslogtreecommitdiff
path: root/scss/types.py
diff options
context:
space:
mode:
Diffstat (limited to 'scss/types.py')
-rw-r--r--scss/types.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/scss/types.py b/scss/types.py
index f3e3b9d..cb0d90f 100644
--- a/scss/types.py
+++ b/scss/types.py
@@ -736,6 +736,17 @@ class String(Value):
self.value + other_value,
quotes='"' if self.quotes else None)
+ def __mul__(self, other):
+ # DEVIATION: Ruby Sass doesn't do this, because Ruby doesn't. But
+ # Python does, and in Ruby Sass it's just fatal anyway.
+ if not isinstance(other, Number):
+ return super(String, self).__mul__(other)
+
+ if not other.is_unitless:
+ raise TypeError("Can only multiply strings by unitless numbers")
+
+ return String(self.value * other.value, quotes=self.quotes)
+
def render(self, compress=False):
return self.__str__()