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
This commit is contained in:
@@ -41,7 +41,7 @@ class L3RouterJointAgentNotifyAPI(n_rpc.RpcProxy):
|
||||
|
||||
def _agent_notification(self, context, method, routers, operation, data):
|
||||
"""Notify individual Cisco cfg agents."""
|
||||
admin_context = context.is_admin and context or context.elevated()
|
||||
admin_context = context if context.is_admin else context.elevated()
|
||||
for router in routers:
|
||||
if router['hosting_device'] is None:
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user