datopian / ckanext-versioning

Deprecated. See https://github.com/datopian/ckanext-versions. ⏰ CKAN extension providing data versioning (metadata and files) based on git and github.
https://tech.datopian.com/versioning/
GNU Affero General Public License v3.0
7 stars 4 forks source link

Fix exception on resource page #58

Closed amercader closed 4 years ago

amercader commented 4 years ago
File '/home/adria/dev/pyenvs/gates/src/ckanext-versioning/ckanext/versioning/templates/package/snippets/resource_views_list.html', line 15 in top-level template code
  {% set current_filters = request.args.get('filters') %}
File '/home/adria/dev/pyenvs/gates/lib/python2.7/site-packages/jinja2/environment.py', line 430 in getattr
  return getattr(obj, attribute)
UndefinedError: 'pylons.controllers.util.Request object' has no attribute 'args'

The resource view snippets were using request.args which is a Flask construct, but on CKAN 2.8 the resource requests are still served by Pylons, which uses request.params.

Added a small helper that uses toolkit.request, which takes care of this, for support across CKAN versions

pdelboca commented 4 years ago

@amercader can this be used to access the query parameter here.

Not for doing it now but to have an answer to that TODO

amercader commented 4 years ago

@pdelboca toolkit.request.params` will work across CKAN versions