svn keywords
[plcapi.git] / PLC / Methods / UpdateInterface.py
index dad6420..61c4557 100644 (file)
@@ -1,4 +1,5 @@
 # $Id$
+# $URL$
 from PLC.Faults import *
 from PLC.Method import Method
 from PLC.Parameter import Parameter, Mixed
@@ -12,7 +13,7 @@ from PLC.Interfaces import Interface, Interfaces
 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 UpdateInterface(Method):
     """
@@ -31,7 +32,8 @@ class UpdateInterface(Method):
 
     roles = ['admin', 'pi', 'tech']
 
-    accepted_fields = Row.accepted_fields(can_update, [Interface.fields,Interface.tags])
+    accepted_fields = Row.accepted_fields(cannot_update, Interface.fields,exclude=True)
+    accepted_fields.update(Interface.tags)
 
     accepts = [
         Auth(),
@@ -45,6 +47,8 @@ class UpdateInterface(Method):
 
         [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 update Interface column(s) %r"%rejected