Re: [Sugar-devel] [PATCH sugar-toolkit] XoColor: don't choke if passed the wrong type (SL#1408)
Excerpts from Simon Schampijer's message of Mon Nov 29 11:22:49 +0100 2010: Acked-by: Simon Schampijer si...@schampijer.de Pushed as 3b0e761 (master) / a56f9b7 (sucrose-0.90), thanks! Sascha -- http://sascha.silbe.org/ http://www.infra-silbe.de/ signature.asc Description: PGP signature ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH sugar-toolkit] XoColor: don't choke if passed the wrong type (SL#1408)
On 10/17/2010 12:09 PM, Sascha Silbe wrote: Color data is stored in the Journal as a JSON dump, so we can get back arbitrary types. XoColor already checks the color string for validity and handles invalid strings gracefully, so it makes sense to enhance this to invalid types as well. Signed-off-by: Sascha Silbesascha-...@silbe.org Acked-by: Simon Schampijer si...@schampijer.de This one looks good. I would probably note the ticket number in the sub-comment as the ticket itself does not make the context directly visible. Or name it (part of SL#1408). Thanks, Simon ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] [PATCH sugar-toolkit] XoColor: don't choke if passed the wrong type (SL#1408)
Color data is stored in the Journal as a JSON dump, so we can get back arbitrary types. XoColor already checks the color string for validity and handles invalid strings gracefully, so it makes sense to enhance this to invalid types as well. Signed-off-by: Sascha Silbe sascha-...@silbe.org --- src/sugar/graphics/xocolor.py |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/src/sugar/graphics/xocolor.py b/src/sugar/graphics/xocolor.py index df60917..395e345 100644 --- a/src/sugar/graphics/xocolor.py +++ b/src/sugar/graphics/xocolor.py @@ -209,6 +209,10 @@ colors = [ def _parse_string(color_string): +if not isinstance(color_string, (str, unicode)): +logging.error('Invalid color string: %r', color_string) +return None + if color_string == 'white': return ['#ff', '#414141'] elif color_string == 'insensitive': -- 1.7.1 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel