diff options
author | Barry Warsaw <barry@python.org> | 1998-10-06 18:10:59 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 1998-10-06 18:10:59 (GMT) |
commit | b7b1cf0088f114f41ccccf98b3fb2e8ed89e674c (patch) | |
tree | 4bed6cc6f3639616f69db342992fb7edd6c74ab7 | |
parent | 5b67839ca3ef12e8fc540b864998f775ecdd7929 (diff) | |
download | cpython-b7b1cf0088f114f41ccccf98b3fb2e8ed89e674c.zip cpython-b7b1cf0088f114f41ccccf98b3fb2e8ed89e674c.tar.gz cpython-b7b1cf0088f114f41ccccf98b3fb2e8ed89e674c.tar.bz2 |
rrggbb_to_triplet(): When color doesn't start with `#' raise a
BadColor exception.
-rw-r--r-- | Tools/pynche/ColorDB.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Tools/pynche/ColorDB.py b/Tools/pynche/ColorDB.py index effed55..b57ad6f 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] |