post = '*'
filterstr = '(|%s)' % (
u' '.join([u'(%s=*%s%s)' % (field, query, post)
- for field in ['cn', 'uid', 'mail']]))
+ for field in ['cn', 'displayName' 'uid', 'mail']]))
r = connection.search_s(
CONFIG.get('connection', 'basedn'),
_ldap.SCOPE_SUBTREE,
cn,data = entry
if 'jpegPhoto' in data:
for jpeg in data['jpegPhoto']:
- name = data['cn'][-1]
+ name = data.get('displayName', data['cn'])[-1]
fd,filename = _tempfile.mkstemp(
prefix= name + '-', suffix='.jpeg')
try:
post = '*'
filterstr = '(|%s)' % (
u' '.join([u'(%s=*%s%s)' % (field, query, post)
- for field in ['cn', 'uid', 'mail']]))
+ for field in ['cn', 'displayName', 'uid', 'mail']]))
r = connection.search_s(
CONFIG.get('connection', 'basedn'),
ldap.SCOPE_SUBTREE,
def format_entry(entry):
cn,data = entry
if 'mail' in data:
+ name = data.get('displayName', data['cn'])[-1]
for m in data['mail']:
- yield email.utils.formataddr((data['cn'][-1], m))
+ yield email.utils.formataddr((name, m))
if __name__ == '__main__':