changeset 863:97ee7594c788

core (xmlui): fixed types with empty value are now correctly managed in _dataFormField2XMLUIData
author Goffi <goffi@goffi.org>
date Tue, 25 Feb 2014 02:22:17 +0100
parents ca7a2bf4fb40
children 241f6baa6687
files src/tools/xml_tools.py
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/tools/xml_tools.py	Mon Feb 24 19:21:07 2014 +0100
+++ b/src/tools/xml_tools.py	Tue Feb 25 02:22:17 2014 +0100
@@ -34,6 +34,7 @@
 
 def _dataFormField2XMLUIData(field):
     """ Get data needed to create an XMLUI's Widget from Wokkel's data_form's Field
+    field can be modified (if it's fixed and it has no value)
     @param field: data_form.Field (it uses field.value, field.fieldType, field.label and field.var)
     @return: widget_type, widget_args, widget_kwargs
 
@@ -42,6 +43,14 @@
     widget_kwargs = {}
     if field.fieldType == 'fixed' or field.fieldType is None:
         widget_type = 'text'
+        if field.value is None:
+            if field.label is None:
+                warning(_("Fixed field has neither value nor label, ignoring it"))
+                field.value = ""
+            else:
+                field.value = field.label
+                field.label = None
+            widget_args[0] = field.value
     elif field.fieldType == 'text-single':
         widget_type = "string"
     elif field.fieldType == 'text-private':