[server/ldap] deal with unicode or str coming out of ldap
It seems we can get either, I've no idea in which exact circumstances,
so this should let us work with both.
--- a/server/sources/ldapfeed.py Thu Nov 19 14:36:54 2015 +0100
+++ b/server/sources/ldapfeed.py Thu Nov 19 15:56:22 2015 +0100
@@ -338,7 +338,7 @@
elif self.user_attrs.get(key) == 'modification_date':
itemdict[key] = datetime.strptime(value[0], '%Y%m%d%H%M%SZ')
else:
- if PY2:
+ if PY2 and value and isinstance(value[0], str):
value = [unicode(val, 'utf-8', 'replace') for val in value]
if len(value) == 1:
itemdict[key] = value = value[0]