Skip to content

Commit e060638

Browse files
committed
black
1 parent b1b804b commit e060638

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

Mergin/test/test_validations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def test_attachment_widget(self):
174174
}
175175
}
176176
# clear DefaultRoot doesn't trigger the warning
177-
config.pop("DefaultRoot", None)
177+
config.pop("DefaultRoot", None)
178178
widget_setup = QgsEditorWidgetSetup("ExternalResource", config)
179179
self.mem_layer.setEditorWidgetSetup(photo_field_idx, widget_setup)
180180
validator.check_attachment_widget()

Mergin/validation.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def check_attachment_widget(self):
244244
continue
245245
for field in layer.fields():
246246
ws = field.editorWidgetSetup()
247-
247+
248248
if ws and ws.type() == "ExternalResource":
249249
cfg = ws.config()
250250
field_name = field.name()
@@ -257,18 +257,24 @@ def check_attachment_widget(self):
257257

258258
# Check for absolute paths
259259
if not (is_root_active or is_storage_active):
260-
if cfg.get("RelativeStorage") == QgsFileWidget.Absolute: # Absolute= 0, RelativeProject= 1, RelativeDefaultPath= 2
260+
if (
261+
cfg.get("RelativeStorage") == QgsFileWidget.Absolute
262+
): # Absolute= 0, RelativeProject= 1, RelativeDefaultPath= 2
261263
self.issues.append(SingleLayerWarning(lid, Warning.ATTACHMENT_ABSOLUTE_PATH, field_name))
262264

263265
# Check Data Defined Overrides
264266
if is_root_active:
265-
prop_type = root_path_prop.get("type") # types are more reliable than keys which can be empty - QGIS decides based on type value
267+
prop_type = root_path_prop.get(
268+
"type"
269+
) # types are more reliable than keys which can be empty - QGIS decides based on type value
266270
if prop_type == 3: # ExpressionBasedProperty
267271
expression = root_path_prop.get("expression", "").strip()
268272
is_field_ref = expression.startswith('"') and expression.endswith('"')
269-
273+
270274
if not (PROJECT_VARS.search(expression) or is_field_ref):
271-
self.issues.append(SingleLayerWarning(lid, Warning.ATTACHMENT_WRONG_EXPRESSION, field_name))
275+
self.issues.append(
276+
SingleLayerWarning(lid, Warning.ATTACHMENT_WRONG_EXPRESSION, field_name)
277+
)
272278
elif prop_type == 2: # FieldBasedProperty
273279
pass
274280
else: # 1 = StaticProperty or 0 = InvalidProperty

0 commit comments

Comments
 (0)