svn keywords
[plcapi.git] / PLC / Methods / AddInterface.py
index 662d7fd..8c6d4cb 100644 (file)
@@ -1,4 +1,5 @@
 # $Id$
+# $URL$
 from PLC.Faults import *
 from PLC.Auth import Auth
 from PLC.Method import Method
@@ -12,7 +13,7 @@ from PLC.InterfaceTags import InterfaceTags
 from PLC.Methods.AddInterfaceTag import AddInterfaceTag
 from PLC.Methods.UpdateInterfaceTag import UpdateInterfaceTag
 
-can_update = ['interface_id', 'node_id']
+cannot_update = ['interface_id', 'node_id']
 
 class AddInterface(Method):
     """
@@ -33,7 +34,8 @@ class AddInterface(Method):
 
     roles = ['admin', 'pi', 'tech']
 
-    accepted_fields = Row.accepted_fields(can_update, [Interface.fields,Interface.tags], exclude=True)
+    accepted_fields = Row.accepted_fields(cannot_update, Interface.fields, exclude=True)
+    accepted_fields.update(Interface.tags)
 
     accepts = [
         Auth(),
@@ -47,9 +49,10 @@ class AddInterface(Method):
     
     def call(self, auth, node_id_or_hostname, interface_fields):
 
-        interface_fields = Row.check_fields (interface_fields, self.accepted_fields)
-
         [native,tags,rejected]=Row.split_fields(interface_fields,[Interface.fields,Interface.tags])
+
+        # type checking
+        native = Row.check_fields (native, self.accepted_fields)
         if rejected:
             raise PLCInvalidArgument, "Cannot add Interface with column(s) %r"%rejected