ntt/eveapi — Issue #7: Recent fix for row data missing attributes that were defined in the rowset
Author: alienbaby
Created: 2012-02-26 18:50:12+00:00
State: open

The fix / (commented ; hack ;) ) for row data missing attributes in the rowset seems to have broken some queries.

Running apitest to get alliances, and also a test to get killlog on a character, and getting char sheet info in apitest all return the following error;

Traceback (most recent call last):
File "C:/Python27/myevetest.py", line 38, in
kills_result=auth.char.Killlog(characterID=char.characterID)
File "C:\Python27\lib\site-packages\eveapi.py", line 274, in __call__
return self._root(self._path, **kw)
File "C:\Python27\lib\site-packages\eveapi.py", line 362, in __call__
return _ParseXML(response, True, store and (lambda obj: cache.store(self._host, path, kw, response, obj)))
File "C:\Python27\lib\site-packages\eveapi.py", line 204, in _ParseXML
obj = _Parser().Parse(response, True)
File "C:\Python27\lib\site-packages\eveapi.py", line 410, in Parse
p.ParseFile(data)
File "C:\Python27\lib\site-packages\eveapi.py", line 485, in tag_start
if col == attributes[row_idx]:
IndexError: list index out of range

It happens in 'alliances' for example, because container._cols has more elemnts defined that are existnig in attributes. container_cols has a filed 'memberCorporation' , but this does not exist in attributes, causing the failure above in the folowing code

[code]
#
# - check for missing columns attribute (see above).
# - check for missing row attributes.
# - check for extra attributes that were not defined in the rowset,
# such as rawQuantity in the assets lists.
# In either case the tag is assumed to be correct and the rowset's
# columns are overwritten with the tag's version, if required.
numAttr = len(attributes)/2
numCols = len(self.container._cols)
if numAttr < numCols:
# the row data is missing attributes that were defined in the rowset.
# missing attributes' values will be set to None.
fixed = []
row_idx = 0; hdr_idx = 0;
for col in self.container._cols:
if col == attributes[row_idx]:
fixed.append(_autocast(col, attributes[row_idx+1]))
row_idx += 2
else:
fixed.append(None)
hdr_idx += 1
self.container.append(fixed)
else:
if not self.container._cols or (numAttr > numCols):
# the row data contains more attributes than were defined.
self.container._cols = attributes[0::2]
self.container.append([_autocast(attributes[i], attributes[i+1]) for i in xrange(0, len(attributes), 2)])
#
[/code]