]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Adding automattic serialization to all requests by moving it to do_request
authorTyler Smith <tylesmit@cisco.com>
Thu, 11 Aug 2011 19:15:12 +0000 (12:15 -0700)
committerTyler Smith <tylesmit@cisco.com>
Thu, 11 Aug 2011 19:15:12 +0000 (12:15 -0700)
quantum/client.py

index ca05236faaec0a621bff28e8d3f74bf4c16bd2ef..9297d3e879f7c6bf69967d222150e336ce76ccde 100644 (file)
@@ -118,6 +118,9 @@ class Client(object):
         if type(params) is dict:
             action += '?' + urllib.urlencode(params)
 
+        if body != None:
+            body = self.serialize(body)
+
         try:
             connection_type = self.get_connection_type()
             headers = headers or {"Content-Type":
@@ -190,7 +193,6 @@ class Client(object):
         """
         Creates a new network on the server
         """
-        body = self.serialize(body)
         return self.do_request("POST", self.networks_path, body=body)
 
     @api_call
@@ -198,7 +200,6 @@ class Client(object):
         """
         Updates a network on the server
         """
-        body = self.serialize(body)
         return self.do_request("PUT", self.network_path % (network), body=body)
 
     @api_call
@@ -241,7 +242,6 @@ class Client(object):
         """
         Sets the state of a port on the server
         """
-        body = self.serialize(body)
         return self.do_request("PUT",
             self.port_path % (network, port), body=body)
 
@@ -257,7 +257,6 @@ class Client(object):
         """
         Deletes a port from a network on the server
         """
-        body = self.serialize(body)
         return self.do_request("PUT",
             self.attachment_path % (network, port), body=body)