from lxml import etree
+import collections
CAS_URI = 'http://www.yale.edu/tp/cas'
NSMAP = {'cas': CAS_URI}
style = etree.SubElement(attributes, CAS + 'attraStyle')
style.text = u'Jasig'
for name, value in attrs.items():
- if isinstance(value, list):
+ if isinstance(value, collections.Iterable) and not isinstance(value, basestring):
for e in value:
element = etree.SubElement(attributes, CAS + name)
element.text = e
style = etree.SubElement(auth_success, CAS + 'attraStyle')
style.text = u'RubyCAS'
for name, value in attrs.items():
- if isinstance(value, list):
+ if isinstance(value, collections.Iterable) and not isinstance(value, basestring):
for e in value:
element = etree.SubElement(auth_success, CAS + name)
element.text = e
element = etree.SubElement(auth_success, CAS + name)
element.text = value
+
def name_value(auth_success, attrs):
etree.SubElement(auth_success, CAS + 'attribute', name=u'attraStyle', value=u'Name-Value')
for name, value in attrs.items():
- if isinstance(value, list):
+ if isinstance(value, collections.Iterable) and not isinstance(value, basestring):
for e in value:
etree.SubElement(auth_success, CAS + 'attribute', name=name, value=e)
else: