XEP-0009 will likely be updated to use <base64 /> instead of <Base64 />

Both are supported when reading, but <base64 /> will be used for output.
This commit is contained in:
Lance Stout 2011-10-05 12:09:50 -04:00
parent e33949c397
commit 3e384d3cfe

View file

@ -63,7 +63,7 @@ def _py2xml(*args):
double.text = str(x)
val.append(double)
elif type(x) is rpcbase64:
b64 = ET.Element("Base64")
b64 = ET.Element("base64")
b64.text = x.encoded()
val.append(b64)
elif type(x) is rpctime:
@ -110,7 +110,10 @@ def _xml2py(value):
return value.find('{%s}string' % namespace).text
if value.find('{%s}double' % namespace) is not None:
return float(value.find('{%s}double' % namespace).text)
if value.find('{%s}base64') is not None:
return rpcbase64(value.find('base64' % namespace).text)
if value.find('{%s}Base64') is not None:
# Older versions of XEP-0009 used Base64
return rpcbase64(value.find('Base64' % namespace).text)
if value.find('{%s}dateTime.iso8601') is not None:
return rpctime(value.find('{%s}dateTime.iso8601'))