<s> from SdpBody import SdpBody <EOL> from types import StringType <EOL> b_types = { '<STR_LIT>' : SdpBody } <EOL> class MsgBody ( object ) : <EOL> content = None <EOL> mtype = None <EOL> needs_update = True <EOL> parsed = False <EOL> def __init__ ( self , content = None , mtype = '<STR_LIT>' , cself = None ) : <EOL> if content != None : <EOL> self . mtype = mtype <EOL> self . content = content <EOL> else : <EOL> self . parsed = True <EOL> if type ( cself . content ) == StringType : <EOL> self . content = cself . content <EOL> else : <EOL> self . content = cself . content . getCopy ( ) <EOL> self . mtype = cself . mtype <EOL> def parse ( self ) : <EOL> if not self . parsed : <EOL> self . parsed = True <EOL> if b_types . has_key ( self . mtype ) : <EOL> self . content = b_types [ self . mtype ] ( self . content ) <EOL> def __str__ ( self ) : <EOL> return str ( self . content ) <EOL> def localStr ( self , local_addr = None , local_port = None ) : <EOL> if type ( self . content ) == StringType : <EOL> return self . content <EOL> return self . content . localStr ( local_addr , local_port ) <EOL> def getType ( self ) : <EOL> return self . mtype <EOL> def getCopy ( self ) : <EOL> if not self . parsed : <EOL> return MsgBody ( self . content ) <EOL> return MsgBody ( cself = self ) </s>
