iteration 4 & last:
[plcapi.git] / PLC / Methods / AddSlice.py
index 0116803..f2edacc 100644 (file)
@@ -4,7 +4,7 @@ from PLC.Faults import *
 from PLC.Method import Method
 from PLC.Parameter import Parameter, Mixed
 from PLC.Slices import Slice, Slices
-from PLC.Auth import PasswordAuth
+from PLC.Auth import Auth
 from PLC.Sites import Site, Sites
 
 can_update = lambda (field, value): field in \
@@ -32,7 +32,7 @@ class AddSlice(Method):
     slice_fields = dict(filter(can_update, Slice.fields.items()))
 
     accepts = [
-        PasswordAuth(),
+        Auth(),
         slice_fields
         ]
 
@@ -40,9 +40,8 @@ class AddSlice(Method):
 
     event_type = 'Add'
     object_type = 'Slice'
-    object_ids = []
 
-    def call(self, auth, slice_fields = {}):
+    def call(self, auth, slice_fields):
         slice_fields = dict(filter(can_update, slice_fields.items()))
 
         # 1. Lowercase.
@@ -57,7 +56,7 @@ class AddSlice(Method):
 
         # Get associated site details
         login_base = name.split("_")[0]
-        sites = Sites(self.api, [login_base]).values()
+        sites = Sites(self.api, [login_base])
         if not sites:
             raise PLCInvalidArgument, "Invalid slice prefix"
         site = sites[0]