summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2015-09-04 01:59:40 +0200
committermathieui <mathieui@mathieui.net>2015-09-04 01:59:40 +0200
commit3978078710774d9675513f0624cde9f1b1ff2615 (patch)
treeca52e4141b9c8ac52c4f904a69537beda94224b6
parent00a069872054b79fec1e29172df995e065485585 (diff)
downloadslixmpp-3978078710774d9675513f0624cde9f1b1ff2615.tar.gz
slixmpp-3978078710774d9675513f0624cde9f1b1ff2615.tar.bz2
slixmpp-3978078710774d9675513f0624cde9f1b1ff2615.tar.xz
slixmpp-3978078710774d9675513f0624cde9f1b1ff2615.zip
vcard-temp: add some checks against wrong input
-rw-r--r--slixmpp/plugins/xep_0054/stanza.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/slixmpp/plugins/xep_0054/stanza.py b/slixmpp/plugins/xep_0054/stanza.py
index cdd6215e..13b36320 100644
--- a/slixmpp/plugins/xep_0054/stanza.py
+++ b/slixmpp/plugins/xep_0054/stanza.py
@@ -324,7 +324,10 @@ class Birthday(ElementBase):
def get_bday(self):
if not self.xml.text:
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):
@@ -343,7 +346,10 @@ class Rev(ElementBase):
def get_rev(self):
if not self.xml.text:
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):
@@ -523,8 +529,11 @@ class TimeZone(ElementBase):
def get_tz(self):
if not self.xml.text:
return xep_0082.tzutc()
- time = xep_0082.parse('00:00:00%s' % self.xml.text)
- return time.tzinfo
+ try:
+ 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)