Add default layerOrder to writeLayerContents

This commit is contained in:
Lasse Fister 2014-12-08 15:43:19 +01:00
parent 24676b3ebb
commit e875cfe3ec

View File

@ -991,12 +991,15 @@ class UFOWriter(object):
""" """
if self.formatVersion < 3: if self.formatVersion < 3:
return return
newOrder = [] if layerOrder is not None:
for layerName in layerOrder: newOrder = []
if layerName is None: for layerName in layerOrder:
layerName = DEFAULT_LAYER_NAME if layerName is None:
newOrder.append(layerName) layerName = DEFAULT_LAYER_NAME
layerOrder = newOrder newOrder.append(layerName)
layerOrder = newOrder
else:
layerOrder = self.layerContents.keys()
if set(layerOrder) != set(self.layerContents.keys()): if set(layerOrder) != set(self.layerContents.keys()):
raise UFOLibError("The layer order contents does not match the glyph sets that have been created.") raise UFOLibError("The layer order contents does not match the glyph sets that have been created.")
layerContents = [(layerName, self.layerContents[layerName]) for layerName in layerOrder] layerContents = [(layerName, self.layerContents[layerName]) for layerName in layerOrder]