[ckan-dev] dataset search and incorrect return value from url_for
Vitor Baptista
vitor at vitorbaptista.com
Fri May 9 22:50:59 UTC 2014
Hi Augusto,
Thanks for creating the issue. We'll talk about it at the dev meeting next
tuesday (which you're more than welcome to join) and follow it up there. If
you find anything new, please add a comment.
Cheers,
2014-05-08 16:19 GMT-03:00 Augusto Herrmann <augusto.herrmann at gmail.com>:
> Hi, Vitor!
>
> Thanks for the quick response. I've opened an issue on Github as
> instructed. The followup is reproduced below:
>
> I don't seem to be able to reproduce this behavior on demo.ckan.orgbecause for some reason on that instance url_for always returns '/dataset'
> (e.g. search for "gold" and it'll go to "
> http://demo.ckan.org/dataset?q=gold" and not "
> http://demo.ckan.org/dataset/search?q=gold"). However, I can tell you
> that on demo.ckan.org the urls based on "/dataset/search" do always
> return empty results (the same we're experiencing). What changed is that on
> older versions "/dataset/search" used to worked just fine, and now they
> don't.
>
> [1] https://github.com/ckan/ckan/issues/1705
>
> Thanks and best regards,
> Augusto Herrmann
>
>
> On Fri, May 2, 2014 at 8:32 PM, Vitor Baptista <vitor at vitorbaptista.com>wrote:
>
>> Hi Augusto,
>>
>> Interesting. Could you reproduce it on http://demo.ckan.org? I tried
>> looking into routing.py to see when we added multiple routes pointing to
>> controller='package', action='search', and it seems like it was in 2010 in
>> CKAN 1.3.3 (
>> https://github.com/ckan/ckan/commit/e1c1f95b2556e95ed6ce17d3bf928b6875194bee),
>> so there might be something else going on.
>>
>> Could you open an issue with this e-mail? It's easier for us to track
>> your bug report.
>>
>> Cheers,
>>
>>
>> 2014-05-02 15:39 GMT-03:00 Augusto Herrmann <augusto.herrmann at gmail.com>:
>>
>>> Dear all,
>>>
>>> we've been receiving seemingly incorrect results in CKAN 2.2 for the
>>> ckan.lib.helpers.url_for function. In a template in an extension we're
>>> developing, for example, the following snippet
>>>
>>> {% url_for controller='package', action='search' %}
>>>
>>> returns "/dataset/search", when the correct url should be just
>>> "/dataset". This incorrect behavior also breaks e.g. faceted navigation
>>> (which we haven't customized, and is the default CKAN one), as all faceted
>>> navigation links point to, e.g., "/dataset/search?tags=transportation"
>>> instead of the correct url "/dataset?tags=transportation". That wrong url
>>> does reveal a search page, however the results of the search are always
>>> empty no matter what (even with no filters at all).
>>>
>>> This affects everywhere url_for is called, e.g. the tag list on /tag
>>> creates links to "/dataset/search" instead of "/dataset".
>>>
>>> Looking into the code, it seems ckan.lib.helpers.url_for [1] wraps
>>> around a call to routes.url_for [2]. These routes seem to be configured in
>>> config.routing [3], but apparently search is defined twice, once in
>>> "/dataset" (L207) and then again in "/dataset/search" (L210-215). Perhaps
>>> this is a bug causing the problem?
>>>
>>> How do we fix this? Sean, do you have any ideas? Any help would be
>>> appreciated.
>>>
>>> [1] https://github.com/ckan/ckan/blob/ckan-2.2/ckan/lib/helpers.py#L110
>>> [2]
>>> https://routes.readthedocs.org/en/latest/modules/util.html?highlight=url_for#routes.util.url_for
>>> [3]
>>> https://github.com/ckan/ckan/blob/ckan-2.2/ckan/config/routing.py#L206
>>>
>>> Best regards,
>>> Augusto Herrmann
>>> Open Data Team - Ministry of Planning - Brazil
>>>
>>> _______________________________________________
>>> 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
>>>
>>>
>>
>>
>> --
>>
>> Vítor Baptista
>>
>> Developer | http://vitorbaptista.com | LinkedIn<http://www.linkedin.com/in/vitorbaptista>|
>> @vitorbaptista <http://twitter.com/vitorbaptista>
>>
>> The Open Knowledge Foundation <http://okfn.org>
>>
>> *Empowering through Open Knowledge*
>>
>> http://okfn.org/ | @okfn <http://twitter.com/okfn> | OKF on Facebook<https://www.facebook.com/OKFNetwork> |
>> Blog <http://blog.okfn.org/> | Newsletter<http://okfn.org/about/newsletter/>
>>
>>
>> _______________________________________________
>> 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
>>
>>
>
> _______________________________________________
> 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
>
>
--
Vítor Baptista
Developer | http://vitorbaptista.com |
LinkedIn<http://www.linkedin.com/in/vitorbaptista>|
@vitorbaptista <http://twitter.com/vitorbaptista>
The Open Knowledge Foundation <http://okfn.org>
*Empowering through Open Knowledge*
http://okfn.org/ | @okfn <http://twitter.com/okfn> | OKF on
Facebook<https://www.facebook.com/OKFNetwork> |
Blog <http://blog.okfn.org/> | Newsletter<http://okfn.org/about/newsletter/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20140509/a57b77f8/attachment-0003.html>
More information about the ckan-dev
mailing list