summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEevee (Alex Munroe) <eevee.git@veekun.com>2013-08-13 13:42:45 -0700
committerEevee (Alex Munroe) <eevee.git@veekun.com>2013-08-13 13:42:45 -0700
commit863d8a0acb806f32e0db52153b1a51045880e043 (patch)
tree56348cf2dcf1cc9f9fb9b3dc380bfc49ef6bbd61
parentb216eb13d87a8b498535594ff1c5980954d7a695 (diff)
downloadpyscss-863d8a0acb806f32e0db52153b1a51045880e043.tar.gz
Restore string * number multiplication.
-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__()