Browse Source

Bugfixes due to datahandler changes

prieto 8 years ago
parent
commit
2f68c55f65

+ 14
- 3
lodel/leapi/datahandlers/base_classes.py View File

@@ -388,9 +388,18 @@ class MultipleRef(Reference):
388 388
             if self.max_item < len(value):
389 389
                 raise FieldValidationError("Too many items")
390 390
         error_list = []
391
-        for i,v in enumerate(value):
391
+        # if we have got a str
392
+        # right place to test this ?
393
+        
394
+        if isinstance(value, str):
395
+            value.replace(" ","")
396
+            s_value=value.split(',')
397
+            value=list(s_value)
398
+        logger.debug(value)
399
+        for i,v in enumerate(s_value):
392 400
             new_val = super()._check_data_value(v)
393
-            value[i]=v
401
+            value[i]=new_val
402
+        logger.debug(value)
394 403
         if len(error_list) >0:
395 404
             raise FieldValidationError("MultipleRef have for error :", error_list)
396 405
         return value
@@ -412,7 +421,9 @@ class MultipleRef(Reference):
412 421
         elif isinstance(cur_value, list):
413 422
             l_value = list()
414 423
             for value in cur_value:
415
-                if isinstance(value,uidtype.cast_type):
424
+                if isinstance(value,str):
425
+                    l_value.append(uidtype.cast_type(value))
426
+                elif isinstance(value,uidtype.cast_type):
416 427
                     l_value.append(value)
417 428
                 else:
418 429
                     raise ValueError("The items must be of the same type, string or %s" % (emcomponent.__name__))

+ 1
- 3
plugins/webui/interface/controllers/admin.py View File

@@ -96,10 +96,8 @@ def admin_create(request):
96 96
         fields = dict()
97 97
 
98 98
         for in_put, in_value in request.form.items():
99
-            if in_put != 'classname':
99
+            if in_put != 'classname' and in_value != '':
100 100
                 fields[in_put[12:]] = in_value
101
-            #else:
102
-            #    fields[in_put] = in_value
103 101
 
104 102
         new_uid = target_leo.insert(fields)
105 103
         

+ 1
- 1
plugins/webui/templates/admin/admin_create.html View File

@@ -6,7 +6,7 @@
6 6
 <ol class="breadcrumb">
7 7
   <li><a href="/{{ root_url }}/admin">Home</a></li>
8 8
   <li><a href="/{{ root_url }}/admin/object_create">Creation</a></li>
9
-  <li class="active">Edit</li>
9
+  <li class="active">{{target.__name__}}</li>
10 10
 </ol>
11 11
 {% if msg is not none %}
12 12
 {% block msg %} <p style="color:red; font-size:20pt; font-weight:bold">{{ msg }}</p> {% endblock %}

+ 1
- 1
plugins/webui/templates/admin/list_classes_create.html View File

@@ -3,7 +3,7 @@
3 3
 {% block body %}
4 4
 <ol class="breadcrumb">
5 5
   <li><a href="/{{ root_url }}/admin">Home</a></li>
6
-  <li class="active">Edit</li>
6
+  <li class="active">Creation</li>
7 7
 </ol>
8 8
 <h1 class="h1_lodel">Creation</h1>
9 9
 <h2>Choose a type to create an instance</h1>

Loading…
Cancel
Save