revised type-checking on taggable classes - previous code would reject any tag
[plcapi.git] / PLC / Methods / AddSlice.py
index 001e0f9..a29b41f 100644 (file)
@@ -35,7 +35,8 @@ class AddSlice(Method):
 
     roles = ['admin', 'pi']
 
-    accepted_fields = Row.accepted_fields(can_update, [Slice.fields,Slice.tags])
+    accepted_fields = Row.accepted_fields(can_update, Slice.fields)
+    accepted_fields.update(Slice.tags)
 
     accepts = [
         Auth(),
@@ -48,6 +49,8 @@ class AddSlice(Method):
 
         [native,tags,rejected]=Row.split_fields(slice_fields,[Slice.fields,Slice.tags])
 
+        # type checking
+        native = Row.check_fields (native, self.accepted_fields)
         if rejected:
             raise PLCInvalidArgument, "Cannot add Slice with column(s) %r"%rejected