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
             if self.max_item < len(value):
388
             if self.max_item < len(value):
389
                 raise FieldValidationError("Too many items")
389
                 raise FieldValidationError("Too many items")
390
         error_list = []
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
             new_val = super()._check_data_value(v)
400
             new_val = super()._check_data_value(v)
393
-            value[i]=v
401
+            value[i]=new_val
402
+        logger.debug(value)
394
         if len(error_list) >0:
403
         if len(error_list) >0:
395
             raise FieldValidationError("MultipleRef have for error :", error_list)
404
             raise FieldValidationError("MultipleRef have for error :", error_list)
396
         return value
405
         return value
412
         elif isinstance(cur_value, list):
421
         elif isinstance(cur_value, list):
413
             l_value = list()
422
             l_value = list()
414
             for value in cur_value:
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
                     l_value.append(value)
427
                     l_value.append(value)
417
                 else:
428
                 else:
418
                     raise ValueError("The items must be of the same type, string or %s" % (emcomponent.__name__))
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
         fields = dict()
96
         fields = dict()
97
 
97
 
98
         for in_put, in_value in request.form.items():
98
         for in_put, in_value in request.form.items():
99
-            if in_put != 'classname':
99
+            if in_put != 'classname' and in_value != '':
100
                 fields[in_put[12:]] = in_value
100
                 fields[in_put[12:]] = in_value
101
-            #else:
102
-            #    fields[in_put] = in_value
103
 
101
 
104
         new_uid = target_leo.insert(fields)
102
         new_uid = target_leo.insert(fields)
105
         
103
         

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

6
 <ol class="breadcrumb">
6
 <ol class="breadcrumb">
7
   <li><a href="/{{ root_url }}/admin">Home</a></li>
7
   <li><a href="/{{ root_url }}/admin">Home</a></li>
8
   <li><a href="/{{ root_url }}/admin/object_create">Creation</a></li>
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
 </ol>
10
 </ol>
11
 {% if msg is not none %}
11
 {% if msg is not none %}
12
 {% block msg %} <p style="color:red; font-size:20pt; font-weight:bold">{{ msg }}</p> {% endblock %}
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
 {% block body %}
3
 {% block body %}
4
 <ol class="breadcrumb">
4
 <ol class="breadcrumb">
5
   <li><a href="/{{ root_url }}/admin">Home</a></li>
5
   <li><a href="/{{ root_url }}/admin">Home</a></li>
6
-  <li class="active">Edit</li>
6
+  <li class="active">Creation</li>
7
 </ol>
7
 </ol>
8
 <h1 class="h1_lodel">Creation</h1>
8
 <h1 class="h1_lodel">Creation</h1>
9
 <h2>Choose a type to create an instance</h1>
9
 <h2>Choose a type to create an instance</h1>

Loading…
Cancel
Save