lib/packet: make protocol_name property instead of attributes

Because it is read-only and to prevent accidental over-write.

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-07-01 14:53:31 +09:00 committed by FUJITA Tomonori
parent 5694ddb74f
commit 43e83726ae

View File

@ -37,7 +37,10 @@ class PacketBase(object):
def __init__(self):
super(PacketBase, self).__init__()
self.length = 0
self.protocol_name = self.__class__.__name__
@property
def protocol_name(self):
return self.__class__.__name__
@classmethod
def parser(cls, buf):