X-Git-Url: https://git.mdrn.pl/django-cas-provider.git/blobdiff_plain/743e480255ba992e40e4723644f1721b1e2928fe..654b8af23c49ae6cc48a3ce826caabddc2b9dc61:/cas_provider/attribute_formatters.py?ds=inline diff --git a/cas_provider/attribute_formatters.py b/cas_provider/attribute_formatters.py index a04828d..55eb4dd 100644 --- a/cas_provider/attribute_formatters.py +++ b/cas_provider/attribute_formatters.py @@ -1,4 +1,5 @@ from lxml import etree +import collections CAS_URI = 'http://www.yale.edu/tp/cas' NSMAP = {'cas': CAS_URI} @@ -10,7 +11,7 @@ def jasig(auth_success, attrs): 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 @@ -23,7 +24,7 @@ def ruby_cas(auth_success, attrs): 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 @@ -35,7 +36,7 @@ def ruby_cas(auth_success, attrs): 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: