# HG changeset patch # User Julien Cristau # Date 1447944982 -3600 # Node ID f3007bbd77e90ad90d95c7ea7867ce909217f9cc # Parent 580a6821713d2dd6dd2969e2ffadca96f5939be4 [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. diff -r 580a6821713d -r f3007bbd77e9 server/sources/ldapfeed.py --- 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]