Ticket #420 (new defect)
suds.xsd.sxbase.SchemaObject item access bug
|Reported by:||jurko||Owned by:||jortel|
suds.xsd.SchemaObject has a __getitem__() function with a bug causing it to only return the initial element (index 0) correctly and return None for any other index.
def __getitem__(self, index): i = 0 for c in self: if i == index: return c
def __getitem__(self, index): """Returns a contained schema object referenced by its 0-based index. Returns None if such an object does not exist. """ i = 0 for c in self: if i == index: return c i += 1
There are other possible issues to consider here like efficiency, rasing IndexError when the specified index is out of scope, etc. but I do not think this issue report is the place to get into them and this patch just tries to 'fix the bug' without changing the original function's intended behaviour.
Best regards, Jurko Gospodnetić