]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Purge use of "PRED and A or B" poor-mans-ternary
authorAngus Lees <gus@inodes.org>
Thu, 31 Jul 2014 03:30:52 +0000 (13:30 +1000)
committerAngus Lees <gus@inodes.org>
Fri, 7 Nov 2014 13:17:12 +0000 (00:17 +1100)
commitea27c8a162f49219f359bb7f6bf14346edc39437
tree5b827a267d8329fc4cc793298b0dfa280a9869fc
parentf16d1dc8c5cda8fed8328938a265a448b9e1a777
Purge use of "PRED and A or B" poor-mans-ternary

Since python2.6, python has a proper ternary construct "A if PRED else
B".  The older idiom "PRED and A or B" has a hidden trap - when A is
itself false, the result is (unexpectedly) B.

This change removes all cases of the older construct found using a
trivial git grep " and .* or " - except one case in oslo common
code (fixed in oslo upstream).

Change-Id: I24461f4328e188c8983ad574495e11e033ec5ba4
20 files changed:
neutron/agent/linux/dhcp.py
neutron/agent/linux/utils.py
neutron/api/rpc/agentnotifiers/l3_rpc_agent_api.py
neutron/api/rpc/agentnotifiers/metering_rpc_agent_api.py
neutron/db/portbindings_db.py
neutron/debug/commands.py
neutron/plugins/brocade/vlanbm.py
neutron/plugins/cisco/l3/rpc/l3_router_rpc_joint_agent_api.py
neutron/plugins/ml2/drivers/arista/db.py
neutron/plugins/vmware/dbexts/lsn_db.py
neutron/plugins/vmware/dbexts/networkgw_db.py
neutron/plugins/vmware/dhcp_meta/lsnmanager.py
neutron/plugins/vmware/nsxlib/__init__.py
neutron/plugins/vmware/vshield/vcns.py
neutron/policy.py
neutron/services/firewall/drivers/linux/iptables_fwaas.py
neutron/services/vpn/service_drivers/__init__.py
neutron/services/vpn/service_drivers/cisco_ipsec.py
neutron/tests/unit/ml2/drivers/cisco/apic/test_cisco_apic_common.py
neutron/tests/unit/vmware/test_nsx_plugin.py