diff --git a/sippy/MsgBody.py b/sippy/MsgBody.py index 0f9b9c7..058fe25 100644 --- a/sippy/MsgBody.py +++ b/sippy/MsgBody.py @@ -29,6 +29,12 @@ b_types = {'application/sdp':SdpBody} +try: + # Python < 3 + str_types = (str, unicode) +except NameError: + str_types = (str,) + class MsgBody(object): content = None mtype = None @@ -40,7 +46,7 @@ def __init__(self, content = None, mtype = 'application/sdp', cself = None): self.mtype = mtype self.content = content else: - if type(cself.content) == str: + if type(cself.content) in str_types: self.content = cself.content else: self.content = cself.content.getCopy() @@ -57,7 +63,7 @@ def __str__(self): return str(self.content) def localStr(self, local_addr = None, local_port = None): - if type(self.content) == str: + if type(self.content) in str_types: return self.content return self.content.localStr(local_addr, local_port)