Make fish config work if one of colors is undefined.

This moves the sorting to be done before sorting remaining colors.
This commit is contained in:
Konrad Borowski 2014-09-23 13:48:00 +02:00
parent a9b7e4582f
commit 8d03baa4e0

View file

@ -483,15 +483,15 @@ class FishConfigHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
result.append(data) result.append(data)
remaining.discard(color_name) remaining.discard(color_name)
# Sort our result (by their keys)
result.sort(key=operator.itemgetter('name'))
# Ensure that we have all the color names we know about, so that if the # Ensure that we have all the color names we know about, so that if the
# user deletes one he can still set it again via the web interface # user deletes one he can still set it again via the web interface
for color_name in remaining: for color_name in remaining:
color_desc = descriptions.get(color_name, '') color_desc = descriptions.get(color_name, '')
result.append([color_name, color_desc, parse_color('')]) result.append([color_name, color_desc, parse_color('')])
# Sort our result (by their keys)
result.sort(key=operator.itemgetter('name'))
return result return result
def do_get_functions(self): def do_get_functions(self):