4 CAS_URI = 'http://www.yale.edu/tp/cas'
5 NSMAP = {'cas': CAS_URI}
12 basestring = (str, bytes)
15 def jasig(auth_success, attrs):
16 attributes = etree.SubElement(auth_success, CAS + 'attributes')
17 style = etree.SubElement(attributes, CAS + 'attraStyle')
19 for name, value in sorted(attrs.items()):
20 if isinstance(value, collections.Iterable) and not isinstance(value, basestring):
22 element = etree.SubElement(attributes, CAS + name)
25 element = etree.SubElement(attributes, CAS + name)
29 def ruby_cas(auth_success, attrs):
30 style = etree.SubElement(auth_success, CAS + 'attraStyle')
31 style.text = 'RubyCAS'
32 for name, value in sorted(attrs.items()):
33 if isinstance(value, collections.Iterable) and not isinstance(value, basestring):
35 element = etree.SubElement(auth_success, CAS + name)
38 element = etree.SubElement(auth_success, CAS + name)
42 def name_value(auth_success, attrs):
43 etree.SubElement(auth_success, CAS + 'attribute', name='attraStyle', value='Name-Value')
44 for name, value in sorted(attrs.items()):
45 if isinstance(value, collections.Iterable) and not isinstance(value, basestring):
47 etree.SubElement(auth_success, CAS + 'attribute', name=name, value=e)
49 etree.SubElement(auth_success, CAS + 'attribute', name=name, value=value)