# 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
    def update_session(self, session):
        return session

    def after_download(self, content, harvest_job):
        return content, []

    def before_update(self, harvest_object, dataset_dict, temp_dict):
        self._before(dataset_dict, temp_dict, harvest_object)

    def after_update(self, harvest_object, dataset_dict, temp_dict):
        return self._after(dataset_dict, temp_dict)

    def before_create(self, harvest_object, dataset_dict, temp_dict):
        self._before_create(harvest_object, dataset_dict)
        self._before(dataset_dict, temp_dict, harvest_object)

    def after_create(self, harvest_object, dataset_dict, temp_dict):
        return self._after(dataset_dict, temp_dict)

    def _before_create(self, harvest_object, dataset_dict):
        title = dataset_dict['title']
        name = HarvesterBase._gen_new_name(title)

        if not name:
            raise Exception('Could not generate a unique name '
                            'from the title or the GUID. Please '
                            'choose a more unique title.')
        dataset_dict['name'] = name

    def _before(self, dataset_dict, temp_dict, job):

# 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

    def update_session(self, session):
        return session

    def after_download(self, content, harvest_job):
        return content, []

    def before_update(self, harvest_object, dataset_dict, temp_dict):
        self._before(dataset_dict, temp_dict, harvest_object)

    def after_update(self, harvest_object, dataset_dict, temp_dict):
        return self._after(dataset_dict, temp_dict)

    def before_create(self, harvest_object, dataset_dict, temp_dict):
        self._before_create(harvest_object, dataset_dict)
        self._before(dataset_dict, temp_dict, harvest_object)

    def after_create(self, harvest_object, dataset_dict, temp_dict):
        return self._after(dataset_dict, temp_dict)

    def _before_create(self, harvest_object, dataset_dict):
        title = dataset_dict['title']
        name = HarvesterBase._gen_new_name(title)

        if not name:
            raise Exception('Could not generate a unique name '
                            'from the title or the GUID. Please '
                            'choose a more unique title.')
        dataset_dict['name'] = name

    def _before(self, dataset_dict, temp_dict, job):

        loc_dict = dataset_dict.pop(LOCALISED_DICT_NAME_BASE, {})