Skip to content

Instantly share code, notes, and snippets.

View amercader's full-sized avatar
🦃

Adrià Mercader amercader

🦃
View GitHub Profile
@amercader
amercader / actions.py
Last active October 11, 2024 10:07
CKAN Pluggable search backend prototype
# This will eventually live in ckan/logic/action/get.py
def search(context, data_dict):
# Check auth
backend = get_search_backend()
# Validate data_dict. Any key not in the standard schema is moved to
@amercader
amercader / gist:510531cecec298d29b99a3815211caa5
Created May 29, 2024 19:57
Tp-Link UB500 Bluetooth dongle on Ubuntu 20.04

The dongle is recognized but the bluetooth UI does not respond

sudo dmesg | grep -i bluetooth

[  371.792424] Bluetooth: hci0: RTL: loading rtl_bt/rtl8761bu_fw.bin
[  371.792455] bluetooth hci0: Direct firmware load for rtl_bt/rtl8761bu_fw.bin failed with error -2
[  371.792459] Bluetooth: hci0: RTL: firmware file rtl_bt/rtl8761bu_fw.bin not found

diff --git a/ckan/lib/search/query.py b/ckan/lib/search/query.py
index c2646f868..205511fac 100644
--- a/ckan/lib/search/query.py
+++ b/ckan/lib/search/query.py
@@ -23,7 +23,7 @@ _open_licenses = None
VALID_SOLR_PARAMETERS = set([
'q', 'fl', 'fq', 'rows', 'sort', 'start', 'wt', 'qf', 'bf', 'boost',
'facet', 'facet.mincount', 'facet.limit', 'facet.field',
- 'extras', 'fq_list', 'tie', 'defType', 'mm', 'df'
+ 'extras', 'fq_list', 'tie', 'defType', 'mm', 'df', 'hl', 'hl.fl',
diff --git a/ckan/plugins/blanket.py b/ckan/plugins/blanket.py
index 8be03eb19..f1c3fa52d 100644
--- a/ckan/plugins/blanket.py
+++ b/ckan/plugins/blanket.py
@@ -1,83 +1,87 @@
# -*- coding: utf-8 -*-
-"""Quick implementations for simplest interfaces.
-
-Decorate plugin with ``@tk.blanket.<GROUP>`` and it will automatically
@amercader
amercader / dataset.json
Created January 25, 2021 20:20
Sections in form with ckanext-scheming
{
"dataset_fields": [
{
"section": "Basic Metadata",
"field_name": "title",
"label": "Title",
"...": "..."
},
{
diff --git a/ckan/lib/signals.py b/ckan/lib/signals.py
index 681de8b92..22b4cc635 100644
--- a/ckan/lib/signals.py
+++ b/ckan/lib/signals.py
@@ -26,16 +26,16 @@ request processing happens.
request_finished = ckan.signal(u'request_finished')
"""This signal is sent right before the response is sent to the
client.
-
"""
#!/usr/bin/env python
'''
Helper script to export datasets metadata from a CKAN instance using the ckanapi library
Usage:
./export_ckan_metadata.py <CKAN URL> <API key>
For example:
@amercader
amercader / action.py
Last active June 14, 2019 09:35
Example plugin with some commonly used interfaces implemented
def collection_show(context, data_dict):
model = context['model']
user = context['user']
id = toolkit.get_or_bust(data_dict, id)
collection = Collection.get(id)
if not collection:
raise toolkit.ObjectNotFound()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
nosetests --reset-db --nologcapture --with-pylons=test-core-custom.ini ckan/tests/legacy -v
No handlers could be found for logger "ckan.lib.uploader"
ckan.tests.legacy.setup_test_search_index ... ok
Test the error response when a user tries to add a tag to a vocab ... ok
ckan.tests.legacy.functional.api.model.test_vocabulary.TestVocabulary.test_add_tag_invalid_name ... ok
ckan.tests.legacy.functional.api.model.test_vocabulary.TestVocabulary.test_add_tag_invalid_vocab_id ... ok
Test the error response when a user tries to create a tag without ... ok
ckan.tests.legacy.functional.api.model.test_vocabulary.TestVocabulary.test_add_tag_not_authorized ... ok
ckan.tests.legacy.functional.api.model.test_vocabulary.TestVocabulary.test_add_tag_not_logged_in ... ok
Test that a tag can be added to and then retrieved from a vocab. ... ok