X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FMethods%2FAddInterface.py;h=69e92ec065eed05f91ed6286a6c2af962d3a097e;hb=c4fb0b1d1fabecb314cc4d5db802ac9c6ffe3708;hp=662d7fdd62c1db2136e4cf5d3aec5ac6be0c517e;hpb=405f2d547603094beb95ef7ab222f776959598d3;p=plcapi.git diff --git a/PLC/Methods/AddInterface.py b/PLC/Methods/AddInterface.py index 662d7fd..69e92ec 100644 --- a/PLC/Methods/AddInterface.py +++ b/PLC/Methods/AddInterface.py @@ -12,7 +12,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 +33,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 +48,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