Skip to content

Commit

Permalink
Follow up previous commit about None in dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustry committed Mar 19, 2024
1 parent c3938e2 commit b34254a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lizmap_server/tooltip.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ def create_popup(html: str) -> str:
</div>\n'''
return template.format(html)

@classmethod
def remove_none(cls, data: dict) -> dict:
""" Remove None values in the dictionary. """
# Might be linked to QGIS 3.36 https://github.com/3liz/lizmap-web-client/issues/4307
return {k: v for k, v in data.items() if v is not None}

@staticmethod
def create_popup_node_item_from_form(
layer: QgsVectorLayer,
Expand Down Expand Up @@ -82,6 +88,7 @@ def create_popup_node_item_from_form(
field_widget_setup = field.editorWidgetSetup()
widget_type = field_widget_setup.type()
widget_config = field_widget_setup.config()
widget_config = Tooltip.remove_none(widget_config)

field_view = Tooltip._generate_field_view(name)

Expand Down

0 comments on commit b34254a

Please sign in to comment.