[python-win32] Sllllllllow ADSI
Itamar S.-T.
itamarst@yahoo.com
Wed, 22 Aug 2001 13:49:26 -0700 (PDT)
Hi,
I'm using ADSI to authenticate and get roles for users
in Zope. I have 3 functions, 1 to authenticate the
user, 1 to get the groups the user is in, and 1 to
check if the user exists, e.g.:
def userExists(username=""):
""" Check if user exists """
try:
ensure_init() # make sure this thread has
CoInitialize() called.
o = adsi.ADsGetObject("WinNT://Mainnt/%s" %
username)
if str(o.Class) == 'User': return 1
except:
pass
return 0
The problem is that this is very slow. It takes 30
seconds the first time it is called, (and the second
time 0.01 seconds). The ensure_init() function is not
responsible for this, I checked.
Any suggestions what I should do?
=====
Itamar Shtull-Trauring, itamar(at)shtull-trauring.org
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/