# Path: ckanext/dcatapit/helpers.py
# DCATAPIT_ENABLE_FORM_TABS = 'ckanext.dcatapit.form_tabs'
# GEONAMES_USERNAME = 'geonames.username'
# GEONAMES_LIMIT_TO = 'geonames.limits.countries'
# DEFAULT_CTX = {'ignore_auth': True}
# DEFAULT_ORG_CTX = DEFAULT_CTX.copy()
# def get_dcatapit_package_schema():
# def get_dcatapit_organization_schema():
# def get_dcatapit_configuration_schema():
# def get_dcatapit_resource_schema():
# def get_vocabulary_items(vocabulary_name, keys=None):
# def get_vocabulary_item(vocabulary_name, key):
# def get_dcatapit_license(license_type):
# def get_package_resource_dcatapit_format_list(pkg_resources, fallback_lang=None):
# def get_localized_field_value(field=None, pkg_id=None, field_type='extra'):
# def get_resource_licenses_tree(value=None, lang=None):
# def list_to_string(_list, _format=None):
# def couple_to_string(field_couples, pkg_dict):
# def couple_to_html(field_couples, pkg_dict):
# def couple_to_dict(field_couples, pkg_dict):
# def format(value, _format='%d-%m-%4Y', _type=None):
# def validate_dateformat(date_string, date_format):
# def json_load(val):
# def json_dump(val):
# def load_json_or_list(val):
# def get_geonames_config():
# def get_localized_subtheme(subtheme_id, lang):
# def get_dcatapit_subthemes(lang):
#     def _get_name(opt_val, depth):
# def dcatapit_string_to_aggregated_themes(value):
# def dcatapit_string_to_localized_aggregated_themes(value, lang):
# def get_organization_by_identifier(context, identifier):
# def get_enable_form_tabs():
# def get_org_context():
# def get_icustomschema_fields():
# def dataset_is_local(pkg_id):
# 
# Path: ckanext/dcatapit/dcat/const.py
# LOCALISED_DICT_NAME_BASE = 'DCATAPIT_MULTILANG_BASE'
# 
# LOCALISED_DICT_NAME_RESOURCES = 'DCATAPIT_MULTILANG_RESOURCES'


import json
import logging
import ckan.plugins as p
import ckanext.dcatapit.interfaces as interfaces
from ckan.lib.munge import munge_name
from ckanext.dcat.interfaces import IDCATRDFHarvester
from ckanext.dcatapit import helpers as dcatapit_helpers
from ckanext.dcatapit.dcat.const import LOCALISED_DICT_NAME_BASE, LOCALISED_DICT_NAME_RESOURCES
from ckanext.harvest.harvesters.base import HarvesterBase

            if holder_identifier and holder_name:

                org = dcatapit_helpers\
                    .get_organization_by_identifier(ctx,
                                                    holder_identifier)
                if not org:
                    org_dict = {'identifier': holder_identifier,
                                'name': munge_name(holder_name),
                                'title': holder_name}
                    act = p.toolkit.get_action('organization_create')
                    org = act(context=ctx, data_dict=org_dict)

                dataset_dict['owner_org'] = org['name']
                # remove holder fields, as this info will be handled in org
                dataset_dict.pop('holder_name', None)
                dataset_dict.pop('holder_identifier', None)

    def _after(self, dataset_dict, temp_dict):
        dcatapit_dict = temp_dict.get('dcatapit')
        if not dcatapit_dict:
            return None

        base_dict = dcatapit_dict[LOCALISED_DICT_NAME_BASE]
        if base_dict:
            pkg_id = dataset_dict['id']
            err = self._save_package_multilang(pkg_id, base_dict)
            if err:
                return err


# Path: ckanext/dcatapit/helpers.py
# DCATAPIT_ENABLE_FORM_TABS = 'ckanext.dcatapit.form_tabs'
# GEONAMES_USERNAME = 'geonames.username'
# GEONAMES_LIMIT_TO = 'geonames.limits.countries'
# DEFAULT_CTX = {'ignore_auth': True}
# DEFAULT_ORG_CTX = DEFAULT_CTX.copy()
# def get_dcatapit_package_schema():
# def get_dcatapit_organization_schema():
# def get_dcatapit_configuration_schema():
# def get_dcatapit_resource_schema():
# def get_vocabulary_items(vocabulary_name, keys=None):
# def get_vocabulary_item(vocabulary_name, key):
# def get_dcatapit_license(license_type):
# def get_package_resource_dcatapit_format_list(pkg_resources, fallback_lang=None):
# def get_localized_field_value(field=None, pkg_id=None, field_type='extra'):
# def get_resource_licenses_tree(value=None, lang=None):
# def list_to_string(_list, _format=None):
# def couple_to_string(field_couples, pkg_dict):
# def couple_to_html(field_couples, pkg_dict):
# def couple_to_dict(field_couples, pkg_dict):
# def format(value, _format='%d-%m-%4Y', _type=None):
# def validate_dateformat(date_string, date_format):
# def json_load(val):
# def json_dump(val):
# def load_json_or_list(val):
# def get_geonames_config():
# def get_localized_subtheme(subtheme_id, lang):
# def get_dcatapit_subthemes(lang):
#     def _get_name(opt_val, depth):
# def dcatapit_string_to_aggregated_themes(value):
# def dcatapit_string_to_localized_aggregated_themes(value, lang):
# def get_organization_by_identifier(context, identifier):
# def get_enable_form_tabs():
# def get_org_context():
# def get_icustomschema_fields():
# def dataset_is_local(pkg_id):
# 
# Path: ckanext/dcatapit/dcat/const.py
# LOCALISED_DICT_NAME_BASE = 'DCATAPIT_MULTILANG_BASE'
# 
# LOCALISED_DICT_NAME_RESOURCES = 'DCATAPIT_MULTILANG_RESOURCES'


# Path: ckanext/dcatapit/dcat/harvester.py
import json
import logging
import ckan.plugins as p
import ckanext.dcatapit.interfaces as interfaces
from ckan.lib.munge import munge_name
from ckanext.dcat.interfaces import IDCATRDFHarvester
from ckanext.dcatapit import helpers as dcatapit_helpers
from ckanext.dcatapit.dcat.const import LOCALISED_DICT_NAME_BASE, LOCALISED_DICT_NAME_RESOURCES
from ckanext.harvest.harvesters.base import HarvesterBase


            if holder_identifier and holder_name:

                org = dcatapit_helpers\
                    .get_organization_by_identifier(ctx,
                                                    holder_identifier)
                if not org:
                    org_dict = {'identifier': holder_identifier,
                                'name': munge_name(holder_name),
                                'title': holder_name}
                    act = p.toolkit.get_action('organization_create')
                    org = act(context=ctx, data_dict=org_dict)

                dataset_dict['owner_org'] = org['name']
                # remove holder fields, as this info will be handled in org
                dataset_dict.pop('holder_name', None)
                dataset_dict.pop('holder_identifier', None)

    def _after(self, dataset_dict, temp_dict):
        dcatapit_dict = temp_dict.get('dcatapit')
        if not dcatapit_dict:
            return None

        base_dict = dcatapit_dict[LOCALISED_DICT_NAME_BASE]
        if base_dict:
            pkg_id = dataset_dict['id']
            err = self._save_package_multilang(pkg_id, base_dict)
            if err:
                return err


        resources_dict = dcatapit_dict[LOCALISED_DICT_NAME_RESOURCES]