Skip to content

data_service.write_relation_values() fails with attribute table edits due to missing relationValues #38

@rsrg-zwiama

Description

@rsrg-zwiama

relationValues = data_service.write_relation_values(get_identity(), result['feature']['id'], feature.get('relationValues', {}), request.files, translator)

If relationValues is not defined in a feature, the exprssion feature.get('relationValues', '{}') creates a string object and not a dictionary. So data_service.write_relation_values() will fail when calling for (rel_table, rel_data) in relationValues.items(): here

for (rel_table, rel_data) in relationValues.items():

relationValues should be fixed by removing the '' from the {} in feature.get('relationValues', '{}'):
relationValues = data_service.write_relation_values(get_identity(), result['feature']['id'], feature.get('relationValues', {}), request.files, translator, True)

error log in data service:

2025-06-18T08:36:49.521073372Z File "/srv/qwc_service/server.py", line 547, in post
2025-06-18T08:36:49.526129872Z relationValues = data_service.write_relation_values(get_identity(), result['feature']['id'], feature.get('relationValues', '{}'), request.files, translator, True)
2025-06-18T08:36:49.526367972Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-06-18T08:36:49.526384172Z File "/srv/qwc_service/data_service.py", line 404, in write_relation_values
2025-06-18T08:36:49.531285072Z for (rel_table, rel_data) in relationValues.items():
2025-06-18T08:36:49.531320472Z ^^^^^^^^^^^^^^^^^^^^
2025-06-18T08:36:49.531539172Z AttributeError: 'str' object has no attribute 'items'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions