Project

General

Profile

« Previous | Next » 

Revision 22eeae99

Added by Thomas Noël over 12 years ago

don't crash if ldap is not available (fix #1620)

View differences:

extra/modules/ezldap_ui.ptl
4 4
entry.
5 5
'''
6 6

  
7
# FIXME: try/except
8
import ldap
9
import ldap.modlist
7
try:
8
    import ldap
9
    import ldap.modlist
10
except ImportError:
11
    ldap = None
10 12

  
11 13
import base64
12 14
import datetime
......
460 462
    misc_cfg = get_cfg('misc', {})
461 463
    ldap_url = misc_cfg.get('aq-ezldap-url')
462 464

  
463
    if not get_publisher().has_site_option('ezldap') or not ldap_url:
465
    if (ldap is None) or (not ldap_url) or (not get_publisher().has_site_option('ezldap')):
464 466
        # no ldap: restore non monkey patched classes & dir
465 467
        get_publisher().user_class = User
466 468
        restore_legacy_root(root_directory)

Also available in: Unified diff