1 from __future__ import unicode_literals
6 CAS_URI = 'http://www.yale.edu/tp/cas'
7 NSMAP = {'cas': CAS_URI}
14 basestring = (str, bytes)
17 def jasig(auth_success, attrs):
18 attributes = etree.SubElement(auth_success, CAS + 'attributes')
19 style = etree.SubElement(attributes, CAS + 'attraStyle')
21 for name, value in sorted(attrs.items()):
22 if isinstance(value, collections.Iterable) and not isinstance(value, basestring):
24 element = etree.SubElement(attributes, CAS + name)
27 element = etree.SubElement(attributes, CAS + name)
31 def ruby_cas(auth_success, attrs):
32 style = etree.SubElement(auth_success, CAS + 'attraStyle')
33 style.text = 'RubyCAS'
34 for name, value in sorted(attrs.items()):
35 if isinstance(value, collections.Iterable) and not isinstance(value, basestring):
37 element = etree.SubElement(auth_success, CAS + name)
40 element = etree.SubElement(auth_success, CAS + name)
44 def name_value(auth_success, attrs):
45 etree.SubElement(auth_success, CAS + 'attribute', name='attraStyle', value='Name-Value')
46 for name, value in sorted(attrs.items()):
47 if isinstance(value, collections.Iterable) and not isinstance(value, basestring):
49 etree.SubElement(auth_success, CAS + 'attribute', name=name, value=e)
51 etree.SubElement(auth_success, CAS + 'attribute', name=name, value=value)