- remove extraneous code
authorMark Huang <mlhuang@cs.princeton.edu>
Wed, 20 Sep 2006 17:26:11 +0000 (17:26 +0000)
committerMark Huang <mlhuang@cs.princeton.edu>
Wed, 20 Sep 2006 17:26:11 +0000 (17:26 +0000)
- fix accepts

PLC/Methods/AdmAddNodeGroup.py

index 3468cf1..88efa7a 100644 (file)
@@ -1,10 +1,7 @@
-
 from PLC.Faults import *
 from PLC.Method import Method
 from PLC.Parameter import Parameter, Mixed
-from PLC.Nodes import Node, Nodes
 from PLC.NodeGroups import NodeGroup, NodeGroups
-#from PLC.Sites import Site, Sites
 from PLC.Auth import PasswordAuth
 
 class AdmAddNodeGroup(Method):
@@ -17,27 +14,17 @@ class AdmAddNodeGroup(Method):
 
     roles = ['admin']
 
-    can_update = lambda (field, value): field in \
-                 ['name', 'description', 'is_custom']
-    update_fields = dict(filter(can_update, NodeGroup.fields.items()))
-       
     accepts = [
         PasswordAuth(),
         NodeGroup.fields['name'],
-        NodeGroup.fields['description'],
-        update_fields
+        NodeGroup.fields['description']
         ]
 
     returns = Parameter(int, 'New nodegroup_id (> 0) if successful')
 
-    def call(self, auth, name, description, optional_vals = {}):
-        if filter(lambda field: field not in self.update_fields, optional_vals):
-            raise PLCInvalidArgument, "Invalid fields specified"
-
+    def call(self, auth, name, description):
        # Create node group
-        node_group = NodeGroup(self.api, optional_vals)
-        node_group['name'] = name
-        node_group['description'] = description
-        node_group.flush()
+        nodegroup = NodeGroup(self.api, {'name': name, 'description': description})
+        nodegroup.flush()
 
-        return node_group['nodegroup_id']
+        return nodegroup['nodegroup_id']