mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-13 14:44:29 -04:00
fix LDAP_LIB loading from venv and other site packages dirs
This commit is contained in:
parent
afc24e802a
commit
861b9cd16f
3 changed files with 54 additions and 25 deletions
|
@ -2,8 +2,6 @@ __package__ = 'archivebox.plugins_auth.ldap'
|
|||
|
||||
import sys
|
||||
|
||||
from functools import cache
|
||||
|
||||
from typing import Dict, List, Optional
|
||||
from pydantic import Field, model_validator, computed_field
|
||||
|
||||
|
@ -12,12 +10,15 @@ from abx.archivebox.base_configset import BaseConfigSet
|
|||
LDAP_LIB = None
|
||||
LDAP_SEARCH = None
|
||||
|
||||
@cache
|
||||
def get_ldap_lib():
|
||||
def get_ldap_lib(extra_paths=()):
|
||||
global LDAP_LIB, LDAP_SEARCH
|
||||
if LDAP_LIB and LDAP_SEARCH:
|
||||
return LDAP_LIB, LDAP_SEARCH
|
||||
try:
|
||||
for path in extra_paths:
|
||||
if path not in sys.path:
|
||||
sys.path.append(path)
|
||||
|
||||
import ldap
|
||||
from django_auth_ldap.config import LDAPSearch
|
||||
LDAP_LIB, LDAP_SEARCH = ldap, LDAPSearch
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue