[ckan-dev] Removing Facets with Plugin

Adrià Mercader adria.mercader at okfn.org
Fri Dec 13 10:37:04 UTC 2019


Hi Trenton,

Can you paste the stacktrace you are getting when the error happens?
Have you tried to create a new dict with just the keys you want?

BTW this list will shut down next week so I encourage you to follow the
discussion in the new mailing list. Check here for details on how to
migrate: https://ckan.org/2019/11/22/migrating-our-mailing-lists/

Adrià


On Wed, 11 Dec 2019 at 09:28, Trenton Manson <tmanson at onipaa.org> wrote:

> Aloha,
>
>
>
> I was trying to remove the license and format facets be deleting from the
> `facets_dict` through the IFacets plugin interface with like below.
>
>
>
> plugins.implements(plugins.IFacets)
>
>
>
>     def dataset_facets(self, facets_dict, package_type):
>
>         '''Add new search facet (filter) for datasets.
>
>         This must be a field in the dataset (or organization or
>
>         group if you're modifying those search facets, just change the
> function).
>
>         '''
>
>
>
>         del facets_dict['license']
>
>         del facets_dict['res_format']
>
>
>
>         # Return the updated facet dict.
>
>         return facets_dict
>
>
>
> This crashes the page.  Am I taking the wrong approach?  Any advice is
> appreciated.
>
>
>
> Mahalo nui,
>
> [image:
> /var/folders/hx/np81c8v9461db4wp5r1_6qrr0000gn/T/com.microsoft.Outlook/Content.MSO/3155E392.tmp]
>
> *Trenton Manson *| Data Science Manager
>
> 1100 Alakea Street  | Honolulu, HI 96813
>
> *Cell*: 808.421.9832 | *Website*:  www.onipaa.org
>
>
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20191213/57e990ab/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 9982 bytes
Desc: not available
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20191213/57e990ab/attachment-0002.png>


More information about the ckan-dev mailing list