Plugin¶
HarvestingPlugin ¶
Bases: SingletonPlugin
, DefaultDatasetForm
Custom plugin to deal with harvesting-related customizations.
This class exists in order to work around a bug in ckanext-spatial:
https://github.com/ckan/ckanext-spatial/issues/277
The mentioned bug prevents being able to have a CKAN extension plugin using both
the IValidators
and the ISpatialHarvester
interfaces at the same time.
As an alternative, we have implemented the current plugin class with the aim to use it strictly for customization of the harvesters (i.e. implement the ISpatialHarvester interface) while the main plugin class (saeoss_plugin.SaeossPlugin) is still handling all of the other SAEOSS customizations.
get_package_dict ¶
Extension point required by ISpatialHarvester
Source code in ckanext/saeoss/plugins/harvesting_plugin.py
get_dataset_reference_date ¶
the reference date can be more than one with different types (creation, revision, publication, ..etc.)
Source code in ckanext/saeoss/plugins/harvesting_plugin.py
get_reference_date_type ¶
with harvesters the data type comes as publication, revision, creation, ... we converts here to 001, 002, 003, ...
Source code in ckanext/saeoss/plugins/harvesting_plugin.py
SaeossPlugin ¶
Bases: SingletonPlugin
, DefaultDatasetForm
after_create ¶
after_delete ¶
after_load ¶
Control plugin loading mechanism
This method is implemented by the SaeossPlugin because we are adding
a 1:1 relationship between our UserExtraFields
model and CKAN's User
model.
SQLAlchemy expects relationships to be configured on both sides, which means we have to modify CKAN's User model in order to make the relationship work. We do that in this function.
Source code in ckanext/saeoss/plugins/saeoss_plugin.py
after_search ¶
IPackageController interface requires reimplementation of this method.
Source code in ckanext/saeoss/plugins/saeoss_plugin.py
after_show ¶
after_unload ¶
after_update ¶
before_create ¶
Extensions will receive this before a resource is created.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
context |
dictionary
|
The context object of the current request, this includes for example access to the |
required |
resource |
dictionary
|
An object representing the resource to be added to the dataset (the one that is about to be created). |
required |
Source code in ckanext/saeoss/plugins/saeoss_plugin.py
before_delete ¶
Receive an object instance before that instance is PURGEd. (whereas usually in ckan 'delete' means to change the state property to deleted, so use before_update for that case.)
Source code in ckanext/saeoss/plugins/saeoss_plugin.py
before_index ¶
before_load ¶
before_show ¶
Extensions will receive the validated data dict before the resource is ready for display.
Be aware that this method is not only called for UI display, but also in other methods, like when a resource is deleted, because package_show is used to get access to the resources in a dataset.
Source code in ckanext/saeoss/plugins/saeoss_plugin.py
before_unload ¶
before_update ¶
Receive an object instance before that instance is UPDATEed.
create ¶
delete ¶
edit ¶
group_facets ¶
IFacets interface requires reimplementation of all facets-related methods
In this case we do not really need to override this method, but need to satisfy IFacets.
Source code in ckanext/saeoss/plugins/saeoss_plugin.py
organization_facets ¶
IFacets interface requires reimplementation of all facets-related methods
In this case we do not really need to override this method, but need to satisfy IFacets.
Source code in ckanext/saeoss/plugins/saeoss_plugin.py
this file holds modules used¶
by emc_dcpr plugin for different¶
functionalities. these modules are¶
different from helper functions as¶
they aren't used by the UI.¶
¶
handle_search ¶
we use combine -AND operator- search params when they are from the same category "e.g. 2 different organizations", and use OR opertaor for different categories.
Source code in ckanext/saeoss/plugins/utils.py
skip_brackets ¶
split the search param while skipping the spaces between brackets and between doubled quotes (e.g. the sasdi theme "Administrative boundaries 1" )