Skip to content
Snippets Groups Projects
Commit d3dff802 authored by Thorge Petersen's avatar Thorge Petersen
Browse files

Harvest blueprint

parent 8955cd77
Branches
Tags
2 merge requests!41Version 2.0.0,!38Merge py3 into dev
......@@ -96,9 +96,11 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm
bp_dashboard.add_url_rule(
u'/dashboard/datasets', view_func=dashboard.dashboard_datasets)
#
# Harvest
bp_harvest = harvest.blueprint
bp_harvest.add_url_rule(u'/harvest/new', view_func=dashboard.new)
bp_harvest.add_url_rule(u'/harvest/new', view_func=harvest.new)
bp_harvest.add_url_rule(u'/harvest', view_func=harvest.search)
return [bp_default, bp_package, bp_user, bp_dashboard, bp_harvest]
# IActions
......
import ckan.plugins.toolkit as toolkit
import ckan.authz as authz
from flask import Blueprint
from ckan.views.dataset import CreateView
import ckan.views.dataset as dataset
from ckan.common import g
import logging
log = logging.getLogger(__name__)
blueprint = Blueprint('odsh_default', __name__)
blueprint = Blueprint('odsh_harvest', __name__)
def new():
log.info("views.harvest::new")
return CreateView.as_view(str(u'new'))
#toolkit.abort(404)
\ No newline at end of file
log.debug("views.harvest::new")
is_sysadmin = authz.is_sysadmin(g.user)
if not is_sysadmin:
toolkit.abort(403)
return dataset.CreateView.as_view(str(u'new'))('harvest')
def search():
log.debug("views.harvest::search")
is_sysadmin = authz.is_sysadmin(g.user)
if not is_sysadmin:
toolkit.abort(403)
return dataset.search('harvest')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment