Do no use random color if metadata color is not valid #1435

This commit is contained in:
Aleksey Lim 2009-10-01 18:04:06 +00:00
parent 3d46fd8c99
commit a4a2b33dac

View File

@ -22,6 +22,8 @@ STABLE.
import random import random
import logging import logging
import gconf
colors = [ colors = [
['#B20008', '#FF2B34'], \ ['#B20008', '#FF2B34'], \
['#FF2B34', '#B20008'], \ ['#FF2B34', '#B20008'], \
@ -229,9 +231,11 @@ class XoColor:
if color_string == None: if color_string == None:
randomize = True randomize = True
elif not is_valid(color_string): elif not is_valid(color_string):
logging.error('Color string is not valid: %s, will generate a ' logging.debug('Color string is not valid: %s, '
'random color pair.', color_string) 'fallback to default', color_string)
randomize = True client = gconf.client_get_default()
color_string = client.get_string('/desktop/sugar/user/color')
randomize = False
else: else:
randomize = False randomize = False