ckan / ckanext-qa

CKAN QA Extension
MIT License
26 stars 52 forks source link

remove dependency on ckan.model.ResourceGroup #7

Closed florianm closed 9 years ago

florianm commented 9 years ago

ckan.model.ResourceGroup was removed from CKAN somewhere in mid 2014. CKAN 2.3a (Nov 2014) runs fine with latest ckanext-qa (qa update and showing resource ratings), but crashes on links under /qa due to reports.py depending on the removed ckan.model.ResourceGroup.

Relevant stack trace (nb. my CKAN lives in /mnt/ckan/ rather than /usr/lib/ckan):

[Mon Nov 24 17:35:34.501070 2014] [:error] [pid 6779] [remote 10.6.20.100:388]   c.organisations = organisations_with_broken_resource_links_by_name()
[Mon Nov 24 17:35:34.501072 2014] [:error] [pid 6779] [remote 10.6.20.100:388] File '/mnt/ckan/default/src/ckanext-qa/ckanext/qa/reports.py', line 150 in organisations_with_broken_resource_links_by_name
[Mon Nov 24 17:35:34.501075 2014] [:error] [pid 6779] [remote 10.6.20.100:388]   result = _get_broken_resource_links().keys()
[Mon Nov 24 17:35:34.501078 2014] [:error] [pid 6779] [remote 10.6.20.100:388] File '/mnt/ckan/default/src/ckanext-qa/ckanext/qa/reports.py', line 165 in _get_broken_resource_links
[Mon Nov 24 17:35:34.501081 2014] [:error] [pid 6779] [remote 10.6.20.100:388]   .join(model.ResourceGroup, model.Package.id == model.ResourceGroup.package_id)\\
[Mon Nov 24 17:35:34.501087 2014] [:error] [pid 6779] [remote 10.6.20.100:388] AttributeError: 'module' object has no attribute 'ResourceGroup'
florianm commented 9 years ago

Deleting the lines containing "ResourceGroup" in ckanext-qa/ckanext/qa/reports.py, deleting the .pyc in site-packages (CKAN_HOME/lib/python2.7/site-packages/ckanext_qa-0.3-py2.7.egg/ckanext/qa/reports.pyc) and restarting the server fixes the server error on accessing qa/dataset/five_stars, /qa/dataset/broken_resource_links, and /qa/organisation/broken_resource_links.

davidread commented 9 years ago

Sounds good, a pull request would be even better.

florianm commented 9 years ago

with pleasure! PR submitted.