]> granicus.if.org Git - python/commitdiff
rrggbb_to_triplet(): When color doesn't start with `#' raise a
authorBarry Warsaw <barry@python.org>
Tue, 6 Oct 1998 18:10:59 +0000 (18:10 +0000)
committerBarry Warsaw <barry@python.org>
Tue, 6 Oct 1998 18:10:59 +0000 (18:10 +0000)
BadColor exception.

Tools/pynche/ColorDB.py

index effed55651049bc235b125141a0789d3672b4a37..b57ad6f2499b65f8aad0d54e899d56fe3864768a 100644 (file)
@@ -177,7 +177,8 @@ def rrggbb_to_triplet(color, atoi=string.atoi):
     """Converts a #rrggbb color to the tuple (red, green, blue)."""
     rgbtuple = _namedict.get(color)
     if rgbtuple is None:
-       assert color[0] == '#'
+        if color[0] <> '#':
+            raise BadColor(color)
        red = color[1:3]
        green = color[3:5]
        blue = color[5:7]