ckan / ckanext-pages

A simple builtin CMS for CKAN sites
GNU General Public License v3.0
51 stars 99 forks source link

Error 500 with ckan 2.5 #58

Closed hlafuente closed 6 years ago

hlafuente commented 6 years ago

Good morning,

I have an error in a ckan 2.5. When I click on the page icon I get a 500 error.

The error is: File '/usr/lib/ckan/default/src/ckanext-pages/ckanext/pages/plugin.py', line 94 in get_plus_icon    ckan_version = float (h.ckan_version () [0: 3]) AttributeError: 'module' object has no attribute 'ckan_version'

I think my ckan.lib.helpers does not have ckan_version()

This is my log file: logerrorpages.zip

Bye.

torfsen commented 6 years ago

The problem is that get_plus_icon uses CKAN's helper function ckan_version which was introduced only recently and is therefore not available on older versions of CKAN. Instead of ckan_version we should use check_ckan_version from the toolkit, which has been available for a much longer time.

Unfortunately the tests did not detect this problem, they ran successfully on CKAN 2.5 when the change was made. So this might be a good idea to improve our test coverage, too.

CC @mattfullerton: the breaking change is in your commit fae750587970d190fc5547a2c323bc11b3858957 (which I've reviewed :sob:)

mattfullerton commented 6 years ago

@torfsen Only seeing this now. Will you fix it or should I?

torfsen commented 6 years ago

@mattfullerton No problem! I'll be working on it when I find time. I just CC'ed you since I wasn't sure whether you added similar code to other extensions that might need to be fixed, too.