Skip to content

Commit

Permalink
Move the datasource value to be calculated before the dict
Browse files Browse the repository at this point in the history
  • Loading branch information
suricactus committed Jul 5, 2023
1 parent 86337a2 commit 422d6a8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions docker-qgis/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,11 @@ def get_layers_data(project: QgsProject) -> Dict[str, Dict]:
error = layer.error()
layer_id = layer.id()
layer_source = LayerSource(layer)
datasource = None

if layer.dataProvider():
datasource = layer.dataProvider().uri().uri()

layers_by_id[layer_id] = {
"id": layer_id,
"name": layer.name(),
Expand All @@ -600,9 +605,7 @@ def get_layers_data(project: QgsProject) -> Dict[str, Dict]:
"QFieldSync/unsupported_source_pk"
),
"is_valid": layer.isValid(),
"datasource": layer.dataProvider().uri().uri()
if layer.dataProvider()
else None,
"datasource": datasource,
"type": layer.type(),
"type_name": layer.type().name,
"error_code": "no_error",
Expand Down

0 comments on commit 422d6a8

Please sign in to comment.