Commit eba12fed authored by Willem ter Berg's avatar Willem ter Berg

unmerge of branches

parent 3cd6d9a4
......@@ -52,7 +52,6 @@ class DONLPlugin(plugins.SingletonPlugin, tk.DefaultDatasetForm):
"""
schema = super(DONLPlugin, self).create_package_schema()
schema = schema_factory.get_schema('DCAT-AP-DONL').create_schema(schema)
schema = schema_factory.get_schema('Data.Overheid').create_schema(schema)
return schema
......@@ -64,7 +63,6 @@ class DONLPlugin(plugins.SingletonPlugin, tk.DefaultDatasetForm):
"""
schema = super(DONLPlugin, self).update_package_schema()
schema = schema_factory.get_schema('DCAT-AP-DONL').update_schema(schema)
schema = schema_factory.get_schema('Data.Overheid').update_schema(schema)
return schema
......@@ -76,7 +74,6 @@ class DONLPlugin(plugins.SingletonPlugin, tk.DefaultDatasetForm):
"""
schema = super(DONLPlugin, self).show_package_schema()
schema = schema_factory.get_schema('DCAT-AP-DONL').show_schema(schema)
schema = schema_factory.get_schema('Data.Overheid').show_schema(schema)
return schema
......
......@@ -27,7 +27,7 @@ _VALUELISTS = {
'mdr_filetype_nal': 'https://waardelijsten.dcat-ap-donl.nl/mdr_filetype_nal.json',
'overheid_dataset_status': 'https://waardelijsten.dcat-ap-donl.nl/overheid_dataset_status.json',
'overheid_frequency': 'https://waardelijsten.dcat-ap-donl.nl/overheid_frequency.json',
#'overheid_license': 'https://waardelijsten.dcat-ap-donl.nl/overheid_license.json',
'overheid_license': 'https://waardelijsten.dcat-ap-donl.nl/overheid_license.json',
'overheid_openbaarheidsniveau': 'https://waardelijsten.dcat-ap-donl.nl/overheid_openbaarheidsniveau.json',
'overheid_spatial_scheme': 'https://waardelijsten.dcat-ap-donl.nl/overheid_spatial_scheme.json',
'overheid_spatial_gemeente': 'https://waardelijsten.dcat-ap-donl.nl/overheid_spatial_gemeente.json',
......@@ -36,8 +36,6 @@ _VALUELISTS = {
'overheid_spatial_waterschap': 'https://waardelijsten.dcat-ap-donl.nl/overheid_spatial_waterschap.json',
'overheid_taxonomiebeleidsagenda': 'https://waardelijsten.dcat-ap-donl.nl/overheid_taxonomiebeleidsagenda.json'
}
# We skip overheid_license since it requires a full CKAN restart for changes in that file to
# take effect.
def update_valuelist(name, online_resource):
......
# encoding: utf-8
"""
Module that applies the system properties of data.overheid.nl to the CKAN schema.
"""
import ckan.plugins.toolkit as tk
def create_schema(schema):
"""
Modifies the CKAN package_create schema to include the data.overheid system properties.
:param schema: dict, the current CKAN schema
:return: dict, the updated schema
"""
optional = tk.get_validator('ignore_missing')
to_extras = tk.get_converter('convert_to_extras')
is_date = tk.get_validator('is_date')
is_bool = tk.get_validator('boolean_validator')
schema.update({
'restriction_statement': [optional, to_extras],
'referentiedata': [optional, is_bool, to_extras],
'high_value': [optional, is_bool, to_extras],
'basisregister': [optional, is_bool, to_extras],
'duplicate_resources': [optional, to_extras]
})
schema['resources'].update({
'link_status': [optional, is_bool],
'link_last_checked_date': [optional, is_date],
'is_duplicate_of': [optional]
})
return schema
def update_schema(schema):
"""
Modifies the CKAN package_update schema to include the data.overheid system properties.
:param schema: dict, the current CKAN schema
:return: dict, the updated schema
"""
optional = tk.get_validator('ignore_missing')
to_extras = tk.get_converter('convert_to_extras')
is_date = tk.get_validator('is_date')
is_bool = tk.get_validator('boolean_validator')
schema.update({
'restriction_statement': [optional, to_extras],
'referentiedata': [optional, is_bool, to_extras],
'high_value': [optional, is_bool, to_extras],
'basisregister': [optional, is_bool, to_extras],
'duplicate_resources': [optional, to_extras]
})
schema['resources'].update({
'link_status': [optional, is_bool],
'link_last_checked_date': [optional, is_date],
'is_duplicate_of': [optional]
})
return schema
def show_schema(schema):
"""
Modifies the CKAN package_show schema to include the data.overheid system properties.
:param schema: dict, the current CKAN schema
:return: dict, the updated schema
"""
optional = tk.get_validator('ignore_missing')
from_extras = tk.get_converter('convert_from_extras')
schema.update({
'restriction_statement': [from_extras, optional],
'referentiedata': [from_extras, optional],
'high_value': [from_extras, optional],
'basisregister': [from_extras, optional],
'duplicate_resources': [from_extras, optional]
})
schema['resources'].update({
'link_status': [optional],
'link_last_checked_date': [optional],
'is_duplicate_of': [optional]
})
return schema
......@@ -5,7 +5,6 @@ Factory module that exposes modules which modify the CKAN schema.
"""
import ckanext.dcatdonl.schema.dcat_ap_donl_schema as dcat_ap_donl_schema
import ckanext.dcatdonl.schema.data_overheid_schema as data_overheid_schema
class SchemaException(Exception):
......@@ -13,8 +12,7 @@ class SchemaException(Exception):
_SCHEMAS = {
'DCAT-AP-DONL': dcat_ap_donl_schema,
'Data.Overheid': data_overheid_schema
'DCAT-AP-DONL': dcat_ap_donl_schema
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment