3

LDAP データにアクセスしているときに、継続的にSize Limit Exceededエラーが発生します。

Google で提示されたソリューションの 1 つは、より厳密な検索フィルターを求めていました。

Python LDAP で 2 つ以上の検索フィルタを組み合わせるにはどうすればよいですか? 提案されたものを使用すると(|(filter1)(filter2))、エラーが発生します。

クエリは次のとおりです。

baseDn = "ou=active, ou=employees, ou=people, o=xxxxx.com";
searchScope = ldap.SCOPE_SUBTREE
#retrieve Certain attributes
retrieveAttributes = ["manageruid","manager","cn"]
search_query = raw_input("Enter the query :")
#This searchFilter needs to be more specific
searchFilter = "city=" + "Bangalore"

try :
   ldap_result_id = l.search(baseDn, searchScope, searchFilter,   retrieveAttributes)
   result_set = []
   while 1:
       result_type, result_data = l.result(ldap_result_id, 0)
       if(result_data == []):
           break
       else:
           if result_type == ldap.RES_SEARCH_ENTRY:
               result_set.append(result_data)
       #print result_set
       print len(result_set)   

except ldap.LDAPError, e:
    print e

検索フィルターを結合しようとしているときに: このエラーが発生します。

 File "practice.py", line 33
    search_filter = (&("city=Bangalore")("manageruid=278586"))
                     ^
SyntaxError: invalid syntax 
4

1 に答える 1