e = parseText(s, True)
if not e:
return # Parse failed
- self.creator = e.getAttribute("Creator")
- self.size = int(e.getAttribute("Size"))
- self.type = int(e.getAttribute("Type"))
- self.location = e.getAttribute("Location")
- self.friendly = e.getAttribute("Friendly")
- self.sha1d = e.getAttribute("SHA1D")
- self.text = s
+ try:
+ self.creator = e.getAttribute("Creator")
+ self.size = int(e.getAttribute("Size"))
+ self.type = int(e.getAttribute("Type"))
+ self.location = e.getAttribute("Location")
+ self.friendly = e.getAttribute("Friendly")
+ self.sha1d = e.getAttribute("SHA1D")
+ self.text = s
+ except TypeError:
+ self.setNull()
+ except ValueError:
+ self.setNull()
class MSNContact:
msnContact.status = params[1]
msnContact.screenName = unquote(params[3])
if len(params) > 4: msnContact.caps = int(params[4])
- if len(params) > 5:
+ if len(params) > 5 and params[5] != "0":
self.handleAvatarHelper(msnContact, params[5])
else:
self.handleAvatarGoneHelper(msnContact)
msnContact.status = params[0]
msnContact.screenName = unquote(params[2])
if len(params) > 3: msnContact.caps = int(params[3])
- if len(params) > 4:
+ if len(params) > 4 and params[4] != "0":
self.handleAvatarHelper(msnContact, params[4])
else:
self.handleAvatarGoneHelper(msnContact)