IATI/IATI-Stats

Lots of errors due to IATI-Rulesets error

Closed this issue · 1 comments

This error occurs following a fresh install of IATI-Stats, and running:

python calculate_stats.py loop

Stacktrace:

Traceback (most recent call last):
  File "/IATI-Stats/statsrunner/loop.py", line 27, in call_stats
    this_out[name] = function()
  File "/IATI-Stats/stats/common/decorators.py", line 43, in wrapper
    out = f(self, *args, **kwargs)
  File "/IATI-Stats/stats/dashboard.py", line 396, in ruleset_passes
    out[ruleset_name] = int(iatirulesets.test_ruleset_subelement(ruleset, self.element))
  File "/IATI-Stats/pyenv/lib/python2.7/site-packages/iatirulesets/__init__.py", line 119, in test_ruleset_subelement
    return test_ruleset(ruleset, ET.ElementTree(fakeroot), *args, **kwargs)
  File "/IATI-Stats/pyenv/lib/python2.7/site-packages/iatirulesets/__init__.py", line 114, in test_ruleset
    return all(x['result'] for x in test_ruleset_verbose(ruleset, tree) if x['result'] is not None)
  File "/IATI-Stats/pyenv/lib/python2.7/site-packages/iatirulesets/__init__.py", line 114, in <genexpr>
    return all(x['result'] for x in test_ruleset_verbose(ruleset, tree) if x['result'] is not None)
  File "/IATI-Stats/pyenv/lib/python2.7/site-packages/iatirulesets/__init__.py", line 102, in test_ruleset_verbose
    yield test_rule(context_xpath, element, rule, case)
  File "/IATI-Stats/pyenv/lib/python2.7/site-packages/iatirulesets/__init__.py", line 87, in test_rule
    result = getattr(rules_, rule)(case)
  File "/IATI-Stats/pyenv/lib/python2.7/site-packages/iatirulesets/__init__.py", line 55, in date_order
    less = self._parse_date(case['less'])
  File "/IATI-Stats/pyenv/lib/python2.7/site-packages/iatirulesets/__init__.py", line 47, in _parse_date
    date_text = date_elements[0].attrib.get('iso-date')
AttributeError: '_ElementStringResult' object has no attribute 'attrib'

The fix is here: IATI/IATI-Rulesets#76

I think this was fixed (or worked around) in #128, by disabling ruleset tests.

It’s still the case that the ruleset code is totally broken, but that’s documented here and there’s a proposed fix here.

Closing.