Are we sure that we want this ?

Later (l. 367) you do `query_layers = layer.queryLayers if layer.queryLayers else l['wmsLayers']`, I think that enough (and better).