Compare commits

...

6 Commits

Author SHA1 Message Date
Alessio Fabrizio 8e79c16ef2 change routes blueprint 2024-10-15 17:25:41 +02:00
Alessio Fabrizio 84d46c2088 logic 2024-10-15 16:59:39 +02:00
Alessio Fabrizio 9d7464d2be get_helpers fix 2024-10-15 16:54:28 +02:00
Alessio Fabrizio c757b8a6c3 move exceptions 2024-10-15 16:51:14 +02:00
Alessio Fabrizio 1555f32afd file req 2024-10-15 16:42:15 +02:00
Alessio Fabrizio 5472edd0de change ckan library 2024-10-15 16:39:48 +02:00
6 changed files with 13 additions and 12 deletions

View File

@ -297,7 +297,7 @@ class D4SciencePlugin(plugins.SingletonPlugin):
# ITemplateHelpers
def get_helpers(self):
return helpers.get_helpers()
return helpers.get_helpers(self)
# IValidators

View File

@ -2,17 +2,18 @@
#from ckan.controllers.home import HomeController
from flask import Blueprint, render_template, g
import ckan.plugins as p
from ckan.common import OrderedDict, _, g
from ckan.common import _, g
import ckan.lib.search as search
import ckan.model as model
import ckan.logic as logic
import ckan.lib.helpers as h
from collections import OrderedDict
#blueprint definition
d4science_home = Blueprint("d4science_home", __name__)
#@d4science_home.route("/catalog")
@d4science_home.route("/")
@d4science_home.route("/d4science_home")
def index():
try:
# package search

View File

@ -7,7 +7,8 @@ import ckan.logic as logic
import ckan.model as model
import ckan.lib.helpers as h
import ckan.lib.search as search
from ckan.common import OrderedDict, _, NotAuthorized, NotFound
from ckan.common import _
from collections import OrderedDict
organization_vre = Blueprint("organization_vre", __name__)
@ -51,7 +52,7 @@ def index():
try:
logic.check_access('site_read', context)
logic.check_access('group_list', context)
except NotAuthorized:
except logic.NotAuthorized:
abort(403, _('Not authorized to see this page'))
# pass user info to context as needed to view private datasets of
# orgs correctly
@ -109,7 +110,7 @@ def read(id, limit=20):
data_dict['include_datasets'] = False
g.group_dict = logic.get_action('group_show')(context, data_dict)
g.group = context['group']
except (NotFound, NotAuthorized):
except (logic.NotFound, logic.NotAuthorized):
abort(404, _('Group not found'))
#read(id, limit, group_type)

View File

@ -1,6 +1,6 @@
import logging
import ckan.plugins as p
from ckan.common import OrderedDict, _
from ckan.common import _
import ckan.lib.search as search
import ckan.model as model
import ckan.logic as logic
@ -8,10 +8,11 @@ import ckan.lib.helpers as h
from flask import Blueprint, render_template, request, g
from ckan.lib.search import SearchError
from urllib.parse import urlencode
from collections import OrderedDict
d4s_type_blueprint = Blueprint('d4s_type', __name__)
@d4s_type_blueprint.route('/')
@d4s_type_blueprint.route('/d4s_type')
def index():
try:
# package search

View File

@ -2,4 +2,3 @@ pytest-ckan
webhelpers2==2.1
xmltodict
pyqrcode
collections

View File

@ -1,4 +1,3 @@
webhelpers2==2.1
xmltodict
pyqrcode
collections