[python-win32] Sllllllllow ADSI

ML lists@net-labs.de
Thu, 23 Aug 2001 00:16:11 +0200


Hi Itamar,

(know you from #zope:) .. I've read a message in some mail-archive, that
if you use the Full-name e.g. "WinNT://<yourdomain>/Mainnt/%s" 
this could solve your problem ..

i haven't tried this .. 

hope this helps

Ulrich Eck
aka jack-e

----- Original Message ----- 
From: "Itamar S.-T." <itamarst@yahoo.com>
To: <python-win32@python.org>
Sent: Wednesday, August 22, 2001 10:49 PM
Subject: [python-win32] Sllllllllow ADSI


> 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/
> 
> _______________________________________________
> Python-win32 mailing list
> Python-win32@python.org
> http://mail.python.org/mailman/listinfo/python-win32
>