From 2c0f74f24c0913a25c1d1dcb84ffa937413a9aca Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Fri, 17 Dec 2010 13:20:10 +0100 Subject: [PATCH] RpcResult: simplify some asserts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit data β« code, eom. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Guido Trotter <ultrotter@google.com> --- lib/rpc.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/rpc.py b/lib/rpc.py index c81c366b2..a4298be33 100644 --- a/lib/rpc.py +++ b/lib/rpc.py @@ -226,12 +226,9 @@ class RpcResult(object): self.fail_msg = None self.payload = data[1] - assert hasattr(self, "call") - assert hasattr(self, "data") - assert hasattr(self, "fail_msg") - assert hasattr(self, "node") - assert hasattr(self, "offline") - assert hasattr(self, "payload") + for attr_name in ["call", "data", "fail_msg", + "node", "offline", "payload"]: + assert hasattr(self, attr_name), "Missing attribute %s" % attr_name @staticmethod def _EnsureErr(val): -- GitLab