You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[source:trunk/pyxmpp/jabber/vcard.py##L394 line 394 of vcard.py] fails when there is no key {{{"value"}}} in the {{{rfc2425parameters}}} dict object. The current code below:
{{{
if rfc2425parameters.get("value").lower()=="uri":
}}}
when {{{"value"}}} does not exist in the dictionary, {{{get("value")}}} returns {{{None}}}, resulting in {{{None.lower()}}} which finally throws an exception:
{{{
AttributeError: 'NoneType' object has no attribute 'lower'
}}}
This is caused by the default return value from get, which itself defaults to {{{None}}}. My fix is to include a default value of empty string:
{{{
if rfc2425parameters.get("value", '').lower()=="uri":
}}}
I also had some trouble with not all of the attributes being initialized when parsing from !rfc2425 versions, my fix is to move the initialization with {{{None}}} out of the if statement on [source:trunk/pyxmpp/jabber/vcard.py##L370 line 370 of vcard.py].
{{{
if isinstance(value,libxml2.xmlNode):
self.uri,self.type,self.image=[None]_3
}}}
becomes
{{{
self.uri,self.type,self.image=[None]_3
if isinstance(value,libxml2.xmlNode):
}}}
[source:trunk/pyxmpp/jabber/vcard.py##L394 line 394 of vcard.py] fails when there is no key {{{"value"}}} in the {{{rfc2425parameters}}} dict object. The current code below:
{{{
if rfc2425parameters.get("value").lower()=="uri":
}}}
when {{{"value"}}} does not exist in the dictionary, {{{get("value")}}} returns {{{None}}}, resulting in {{{None.lower()}}} which finally throws an exception:
{{{
AttributeError: 'NoneType' object has no attribute 'lower'
}}}
This is caused by the default return value from get, which itself defaults to {{{None}}}. My fix is to include a default value of empty string:
{{{
if rfc2425parameters.get("value", '').lower()=="uri":
}}}
I also had some trouble with not all of the attributes being initialized when parsing from !rfc2425 versions, my fix is to move the initialization with {{{None}}} out of the if statement on [source:trunk/pyxmpp/jabber/vcard.py##L370 line 370 of vcard.py].
{{{
if isinstance(value,libxml2.xmlNode):
self.uri,self.type,self.image=[None]_3
}}}
becomes
{{{
self.uri,self.type,self.image=[None]_3
if isinstance(value,libxml2.xmlNode):
}}}
Copy of the PyXMPP issue Jajcus/pyxmpp#13
The text was updated successfully, but these errors were encountered: