[ckan-dev] CkanUrlException when calling controller 'package'
Neuvonen Samuli
samuli.neuvonen at ymparisto.fi
Thu Dec 13 09:13:44 UTC 2018
Hello again,
I now changed the offending line to
{% set basehref = h.url_for('dataset.read', id='new') %}
and it seems to work. Don't know if this is the right way to do it, though.
Sam
-----Original Message-----
From: ckan-dev [mailto:ckan-dev-bounces at lists.okfn.org] On Behalf Of Neuvonen Samuli
Sent: 13. joulukuuta 2018 9:56
To: ckan-dev at lists.okfn.org
Subject: [ckan-dev] CkanUrlException when calling controller 'package'
Dear all,
In a template of my custom theme (plugin) I call the helper function url_for like this:
{% set basehref = h.url_for(controller='package', action='new') %}
This works fine on an older ckan-instance but now that I installed a new one, this line gives an error:
File "/usr/lib/ckan/default/src/ckanext-theme-syke/ckanext/syke_theme/templates/package/search.html", line 3, in top-level template code
{% set basehref = h.url_for(controller='package', action='new') %}
File "/usr/lib/ckan/default/src/ckan/ckan/lib/helpers.py", line 342, in url_for
return _local_url(my_url, locale=locale, **kw)
File "/usr/lib/ckan/default/src/ckan/ckan/lib/helpers.py", line 545, in _local_url
raise ckan.exceptions.CkanUrlException(error)
CkanUrlException: There is a broken url being created {'action': 'new', 'controller': 'package'}
Looking at the helpers.py code, the error is apparently triggered by this bit in function _local_url:
if url == '/packages':
error = 'There is a broken url being created %s' % kw
raise ckan.exceptions.CkanUrlException(error)
But why? And how to get around it?
There was an earlier discussion on the list about a similar error message resulting from not calling a custom controller with a full name, but somehow I think there is probably something else going on here, since the same code works on another instance. Also, I'm not sure what the full name for a ckan-core controller would be. ckan.controllers.package:PackageController?
Thanks for any ideas,
Sam
_______________________________________________
ckan-dev mailing list
ckan-dev at lists.okfn.org
https://lists.okfn.org/mailman/listinfo/ckan-dev
Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
More information about the ckan-dev
mailing list