From: Barry Warsaw Date: Tue, 6 Oct 1998 18:10:59 +0000 (+0000) Subject: rrggbb_to_triplet(): When color doesn't start with `#' raise a X-Git-Tag: v1.5.2a2~144 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b7b1cf0088f114f41ccccf98b3fb2e8ed89e674c;p=python rrggbb_to_triplet(): When color doesn't start with `#' raise a BadColor exception. --- diff --git a/Tools/pynche/ColorDB.py b/Tools/pynche/ColorDB.py index effed55651..b57ad6f249 100644 --- a/Tools/pynche/ColorDB.py +++ b/Tools/pynche/ColorDB.py @@ -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]