]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Using substitution for Python String
authorDongcan Ye <hellochosen@gmail.com>
Sun, 6 Dec 2015 04:56:17 +0000 (12:56 +0800)
committerDongcan Ye <hellochosen@gmail.com>
Sun, 6 Dec 2015 08:34:43 +0000 (16:34 +0800)
This patch using String substitution instead of String concatenation.

Change-Id: I1faabeb1943449ae60232e08a842652c86793a45

neutron/agent/common/ovs_lib.py

index cb652b5597eab001a848ba1ad8f618a4bfde892a..9c5f3d53306ebad9c3254f8996583362b5c462b2 100644 (file)
@@ -99,10 +99,11 @@ class VifPort(object):
         self.switch = switch
 
     def __str__(self):
-        return ("iface-id=" + self.vif_id + ", vif_mac=" +
-                self.vif_mac + ", port_name=" + self.port_name +
-                ", ofport=" + str(self.ofport) + ", bridge_name=" +
-                self.switch.br_name)
+        return ("iface-id=%s, vif_mac=%s, port_name=%s, ofport=%s, "
+                "bridge_name=%s") % (
+                    self.vif_id, self.vif_mac,
+                    self.port_name, self.ofport,
+                    self.switch.br_name)
 
 
 class BaseOVS(object):