review (and fix) the way we retrieve the subject object
[plcapi.git] / PLC / Methods / DeleteInterfaceTag.py
index 1bb4aad..b1672a7 100644 (file)
@@ -40,7 +40,11 @@ class DeleteInterfaceTag(Method):
 
         tag_type_id = interface_tag['tag_type_id']
         tag_type = TagTypes (self.api,[tag_type_id])[0]
-        interface = Interfaces (self.api, interface_tag['interface_id'])
+
+        interfaces = Interfaces (self.api, interface_tag['interface_id'])
+        if not interfaces:
+            raise PLCInvalidArgument, "No such interface %d"%interface_tag['interface_id']
+        interface=interfaces[0]
 
         # check authorizations
         if 'admin' in self.caller['roles']: