api now allows marshalling of None (although type checking does not allow None yet...
authorMark Huang <mlhuang@cs.princeton.edu>
Tue, 10 Oct 2006 20:25:48 +0000 (20:25 +0000)
committerMark Huang <mlhuang@cs.princeton.edu>
Tue, 10 Oct 2006 20:25:48 +0000 (20:25 +0000)
PLC/Methods/UpdateNode.py
PLC/Methods/UpdateNodeNetwork.py
PLC/Methods/UpdatePerson.py
PLC/Methods/UpdateSite.py

index f80b779..f9d02d4 100644 (file)
@@ -38,14 +38,6 @@ class UpdateNode(Method):
         if filter(lambda field: field not in self.update_fields, update_fields):
             raise PLCInvalidArgument, "Invalid field specified"
 
-        # XML-RPC cannot marshal None, so we need special values to
-        # represent "unset".
-        for key, value in update_fields.iteritems():
-            if value == -1 or value == "null":
-                if key in ['hostname', 'boot_state']:
-                    raise PLCInvalidArgument, "hostname and boot_state cannot be unset"
-                update_fields[key] = None
-
         # Get account information
         nodes = Nodes(self.api, [node_id_or_hostname])
         if not nodes:
index 8e0b267..393b6e4 100644 (file)
@@ -41,14 +41,6 @@ class UpdateNodeNetwork(Method):
         if filter(lambda field: field not in self.update_fields, update_fields):
             raise PLCInvalidArgument, "Invalid fields specified"
 
-        # XML-RPC cannot marshal None, so we need special values to
-        # represent "unset".
-        for key, value in update_fields.iteritems():
-            if value == -1 or value == "null":
-                if key in ['method', 'type', 'mac', 'ip', 'bwlimit']:
-                    raise PLCInvalidArgument, "%s cannot be unset" % key
-                update_fields[key] = None
-
        # Get node network information
        nodenetworks = NodeNetworks(self.api, [nodenetwork_id_or_hostname]).values()
        if not nodenetworks:
index a79a461..140b563 100644 (file)
@@ -40,14 +40,6 @@ class UpdatePerson(Method):
         if filter(lambda field: field not in self.update_fields, update_fields):
             raise PLCInvalidArgument, "Invalid field specified"
 
-        # XML-RPC cannot marshal None, so we need special values to
-        # represent "unset".
-        for key, value in update_fields.iteritems():
-            if value == -1 or value == "null":
-                if key in ['first_name', 'last_name']:
-                    raise PLCInvalidArgument, "first_name and last_name cannot be unset"
-                update_fields[key] = None
-
         # Get account information
         persons = Persons(self.api, [person_id_or_email])
         if not persons:
index 3b3a908..bb51747 100644 (file)
@@ -42,14 +42,6 @@ class UpdateSite(Method):
         if filter(lambda field: field not in self.update_fields, update_fields):
             raise PLCInvalidArgument, "Invalid field specified"
 
-        # XML-RPC cannot marshal None, so we need special values to
-        # represent "unset".
-        for key, value in update_fields.iteritems():
-            if value == -1 or value == "null":
-                if key not in ['latitude', 'longitude', 'url']:
-                    raise PLCInvalidArgument, "%s cannot be unset" % key
-                update_fields[key] = None
-
         # Get site information
         sites = Sites(self.api, [site_id_or_login_base])
         if not sites: