Beispiel #1
0
    def read_catalog(self, _format=None):

        if not _format:
            _format = check_access_header()

        if not _format:
            return HomeController().index()

        _profiles = toolkit.request.params.get('profiles')
        if _profiles:
            _profiles = _profiles.split(',')

        data_dict = {
            'page': toolkit.request.params.get('page'),
            'modified_since': toolkit.request.params.get('modified_since'),
            'format': _format,
            'profiles': _profiles,
        }

        toolkit.response.headers.update(
            {'Content-type': CONTENT_TYPES[_format]})
        try:
            return toolkit.get_action('dcat_catalog_show')({}, data_dict)
        except toolkit.ValidationError, e:
            toolkit.abort(409, str(e))
Beispiel #2
0
    def read_catalog(self, _format=None):
        log.debug('Leyendo catalog')
        if not _format:
            _format = check_access_header()

        if not _format:
            return HomeController().index()

        data_dict = {
            'page': toolkit.request.params.get('page'),
            'modified_since': toolkit.request.params.get('modified_since'),
            'format': _format,
        }

        toolkit.response.headers.update(
            {'Content-type': CONTENT_TYPES[_format]})
        try:
            return toolkit.get_action('iaest_catalog_show')({}, data_dict)
        except toolkit.ValidationError, e:
            toolkit.abort(409, str(e))
Beispiel #3
0
    def read_catalog(self, _format=None):

        if not _format:
            _format = check_access_header()

        if not _format:
            return HomeController().index()

        data_dict = {
            'page': toolkit.request.params.get('page'),
            'modified_since': toolkit.request.params.get('modified_since'),
            'format': _format,
            'fq': '-berlin_source:harvest-fisbroker',
        }

        toolkit.response.headers.update(
            {'Content-type': CONTENT_TYPES[_format]})
        try:
            return toolkit.get_action('dcat_catalog_show')({}, data_dict)
        except toolkit.ValidationError, e:
            toolkit.abort(409, str(e))
Beispiel #4
0
import json

from ckan import model
from ckan.plugins import toolkit

if toolkit.check_ckan_version(min_version='2.1'):
    BaseController = toolkit.BaseController
else:
    from ckan.lib.base import BaseController

if toolkit.check_ckan_version(max_version='2.8.99'):
    from ckan.controllers.package import PackageController
    from ckan.controllers.home import HomeController
    read_endpoint = PackageController().read
    index_endpoint = HomeController().index
else:
    from ckan.views.home import index as index_endpoint
    from ckan.views.dataset import read as read_endpoint

from ckanext.dcat.utils import CONTENT_TYPES, parse_accept_header
from ckanext.dcat.processors import RDFProfileException


def _get_package_type(id):
    """
    Given the id of a package this method will return the type of the
    package, or 'dataset' if no type is currently set
    """
    pkg = model.Package.get(id)
    if pkg:
        return pkg.type or u'dataset'