pyad
pyad copied to clipboard
delete user raises AttrbibuteError
What could be causing this issue? I created the user and it seems to have worked, but then delete fails:
In [30]: aduser.ADUser.from_cn("lrhazi-test").delete()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-30-a69fd250a9e1> in <module>()
----> 1 aduser.ADUser.from_cn("lrhazi-test").delete()
c:\python27\lib\site-packages\pyad\adobject.pyc in delete(self)
535 """Deletes the object from the domain"""
536 parent = self.parent_container
--> 537 if not parent:
538 raise Exception("Object does not have a parent container. Cannot be deleted")
539 else:
c:\python27\lib\site-packages\future\types\newobject.pyc in __nonzero__(self)
88 return type(self).__bool__(self)
89 if hasattr(self, '__len__'):
---> 90 return type(self).__len__(self)
91 # object has no __nonzero__ method
92 return True
AttributeError: type object 'ADContainer' has no attribute '__len__'
In [31]:
The ADObject doesn't implement a len and when trying to delete it calls 'if not parent' which will call len.