vcard-temp: add some checks against wrong input
This commit is contained in:
parent
00a0698720
commit
3978078710
@ -324,7 +324,10 @@ class Birthday(ElementBase):
|
|||||||
def get_bday(self):
|
def get_bday(self):
|
||||||
if not self.xml.text:
|
if not self.xml.text:
|
||||||
return None
|
return None
|
||||||
return xep_0082.parse(self.xml.text)
|
try:
|
||||||
|
return xep_0082.parse(self.xml.text)
|
||||||
|
except ValueError:
|
||||||
|
return self.xml.text
|
||||||
|
|
||||||
|
|
||||||
class Rev(ElementBase):
|
class Rev(ElementBase):
|
||||||
@ -343,7 +346,10 @@ class Rev(ElementBase):
|
|||||||
def get_rev(self):
|
def get_rev(self):
|
||||||
if not self.xml.text:
|
if not self.xml.text:
|
||||||
return None
|
return None
|
||||||
return xep_0082.parse(self.xml.text)
|
try:
|
||||||
|
return xep_0082.parse(self.xml.text)
|
||||||
|
except ValueError:
|
||||||
|
return self.xml.text
|
||||||
|
|
||||||
|
|
||||||
class Title(ElementBase):
|
class Title(ElementBase):
|
||||||
@ -523,8 +529,11 @@ class TimeZone(ElementBase):
|
|||||||
def get_tz(self):
|
def get_tz(self):
|
||||||
if not self.xml.text:
|
if not self.xml.text:
|
||||||
return xep_0082.tzutc()
|
return xep_0082.tzutc()
|
||||||
time = xep_0082.parse('00:00:00%s' % self.xml.text)
|
try:
|
||||||
return time.tzinfo
|
time = xep_0082.parse('00:00:00%s' % self.xml.text)
|
||||||
|
return time.tzinfo
|
||||||
|
except ValueError:
|
||||||
|
return self.xml.text
|
||||||
|
|
||||||
|
|
||||||
register_stanza_plugin(VCardTemp, Name)
|
register_stanza_plugin(VCardTemp, Name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user