GoodPotatoes wrote:
I am using the module active_directory and have an ad object called myuser.

I would like to run a series of statements like:

myuser.attribute

where attribute is a string variable, but python says that this is not the correct syntax.

error:
for x in myuser.properties: # "myuser.properties" returns a tuple of properties associated with the myuser AD object
    print myuser.x

Traceback (most recent call last):
  File "<pyshell#148>", line 2, in <module>
    print myuser.x
File "build\bdist.win32\egg\active_directory.py", line 421, in __getattr__
    raise AttributeError
AttributeError


print getattr(myuser ,x)


example:
>>> myuser.properties[0] #first value in user tuple
u'cn'
>>> myuser.cn
u'Joe Sixpack'

How can I iterate through all of the values of the properties tuple and get each value?

------------------------------------------------------------------------

_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


--
Bob Gailer
Chapel Hill NC
919-636-4239
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to