ofproto_parser: simplify msg_str_attr() a bit

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
Isaku Yamahata 2013-05-13 12:03:25 +09:00 committed by FUJITA Tomonori
parent ed06fbd397
commit 0fb2bbae4f

View File

@ -150,10 +150,7 @@ def msg_pack_into(fmt, buf, offset, *args):
def msg_str_attr(msg, buf, attr_list=None):
if attr_list is None:
exclude = ['_attributes']
try:
exclude += msg._attributes
except AttributeError:
pass
exclude += getattr(msg, '_attributes', [])
attr_list = set(dir(msg)) - set(exclude)
for attr in attr_list:
val = getattr(msg, attr, None)