What is the bug?
When clicking on the button "Copy the drag and drop designer" (or when selecting "QGIS Drag&Drop form" as popup source) for a layer that has a field with a Value Map widget containing an entry without a value, the plugin crashes with:
AttributeError: 'NoneType' object has no attribute 'replace'
Traceback:
File "...\lizmap\plugin\core.py", line 1354, in maptip_from_form
html_content = Tooltip.create_popup_node_item_from_form(
File "...\lizmap\tooltip.py", line 197, in create_popup_node_item_from_form
h = Tooltip.create_popup_node_item_from_form(
File "...\lizmap\tooltip.py", line 125, in create_popup_node_item_from_form
field_view = Tooltip._generate_value_map(widget_config, name)
File "...\lizmap\tooltip.py", line 306, in escape_value
return value.replace("'", "'")
AttributeError: 'NoneType' object has no attribute 'replace'
Root cause: The affected field uses a Value Map widget in QGIS. One of its entries has no value at all, stored in the .qgs file as:
<Option type="invalid" name=" "/>
(type="invalid" is QGIS's internal representation for "no value", distinct from an empty string). This happens when a Value Map row is given a display label but the value column is left blank. _generate_value_map() builds row.items() from this config and calls escape_value() on every key and value without checking for None, causing the crash.
Steps to reproduce:
- Add a field with widget type "Value Map" on a layer.
- In the Value Map editor, add an entry with a label/description but leave the value empty.
- Build a Drag&Drop attribute form including that field.
- In the Lizmap plugin, open the layer's Popup configuration and either select "QGIS Drag&Drop form" or click "Copy the drag and drop designer".
- The traceback above appears.
Expected behavior: escape_value() (and/or _generate_value_map()) should handle None values gracefully — e.g. treat them as an empty string — instead of crashing the whole popup/maptip generation.
Suggested fix:
def escape_value(value):
if value is None:
return ''
return value.replace("'", "'")
Versions, safeguards, checks summary etc
Versions :
- Lizmap Web Client : 3.10.0-rc.3-pre.11635 - commit 4c86f09a0 3liz/lizmap-web-client@4c86f09a0
- Lizmap plugin : 5.0.0-rc.2
- QGIS Desktop : 3.44.12
- QGIS Server : 3.44.12
- Py-QGIS-Server : 1.9.6
- QGIS Server plugin atlasprint : 3.4.4
- QGIS Server plugin lizmap_server : 2.14.1
- QGIS Server plugin wfsOutputExtension : 1.8.3
- QGIS Server plugin wmsGetLegendGraphicTitle : 1.3
List of Lizmap Web Client modules :
* Version Lizmap Web Client 3.8 needed
List of safeguards :
* Mode : normal
* Allow parent folder : yes
* Number of parent : 4 folder(s)
* Prevent other drive : no
* Prevent PG service : no
* Prevent PG Auth DB : no
* Force PG user&pass : no
* Prevent ECW : yes
Check Lizmap plugin
What is the bug?
When clicking on the button "Copy the drag and drop designer" (or when selecting "QGIS Drag&Drop form" as popup source) for a layer that has a field with a Value Map widget containing an entry without a value, the plugin crashes with:
Traceback:
Root cause: The affected field uses a Value Map widget in QGIS. One of its entries has no value at all, stored in the .qgs file as:
(
type="invalid"is QGIS's internal representation for "no value", distinct from an empty string). This happens when a Value Map row is given a display label but the value column is left blank._generate_value_map()buildsrow.items()from this config and callsescape_value()on every key and value without checking forNone, causing the crash.Steps to reproduce:
Expected behavior:
escape_value()(and/or_generate_value_map()) should handleNonevalues gracefully — e.g. treat them as an empty string — instead of crashing the whole popup/maptip generation.Suggested fix:
Versions, safeguards, checks summary etc
Versions :
List of Lizmap Web Client modules :
* Version Lizmap Web Client 3.8 needed
List of safeguards :
* Mode : normal
* Allow parent folder : yes
* Number of parent : 4 folder(s)
* Prevent other drive : no
* Prevent PG service : no
* Prevent PG Auth DB : no
* Force PG user&pass : no
* Prevent ECW : yes
Check Lizmap plugin