use blueprint instead of controllers

This commit is contained in:
Alessio Fabrizio 2024-10-11 16:00:20 +02:00
parent e37a17838d
commit ec62dc0c76
9 changed files with 287 additions and 335 deletions

View File

@ -1,5 +1,6 @@
import logging
from ckan.controllers.home import HomeController
#import logging
#from ckan.controllers.home import HomeController
from flask import Blueprint, render_template, g
import ckan.plugins as p
from ckan.common import OrderedDict, _, g, c
import ckan.lib.search as search
@ -9,63 +10,65 @@ import ckan.lib.maintain as maintain
import ckan.lib.base as base
import ckan.lib.helpers as h
class d4SHomeController():
#blueprint definition
d4science_home = Blueprint("d4science_home", __name__)
#Overriding controllers.HomeController.index method
def index(self):
try:
# package search
context = {'model': model, 'session': model.Session,'user': c.user, 'auth_user_obj': c.userobj}
#@d4science_home.route("/catalog")
@d4science_home.route("/")
def index():
try:
# package search
context = {'model': model, 'session': model.Session,'user': g.user, 'auth_user_obj': g.userobj}
facets = OrderedDict()
facets = OrderedDict()
default_facet_titles = {
'organization': _('Organizations'),
'groups': _('Groups'),
'tags': _('Tags'),
'res_format': _('Formats'),
'license_id': _('Licenses'),
}
for facet in g.facets:
if facet in default_facet_titles:
facets[facet] = default_facet_titles[facet]
else:
facets[facet] = facet
# Facet titles
for plugin in p.PluginImplementations(p.IFacets):
facets = plugin.dataset_facets(facets, 'dataset')
c.facet_titles = facets
data_dict = {
'q': '*:*',
'facet.field': list(facets.keys()),
'rows': 4,
'start': 0,
'sort': 'views_recent desc',
'fq': 'capacity:"public"'
default_facet_titles = {
'organization': _('Organizations'),
'groups': _('Groups'),
'tags': _('Tags'),
'res_format': _('Formats'),
'license_id': _('Licenses'),
}
query = logic.get_action('package_search')(context, data_dict)
c.search_facets = query['search_facets']
c.package_count = query['count']
c.datasets = query['results']
#print "c.search_facets: "
#print " ".join(c.search_facets)
except search.SearchError:
c.package_count = 0
if c.userobj and not c.userobj.email:
url = h.url_for(controller='user', action='edit')
msg = _('Please <a href="%s">update your profile</a>'
' and add your email address. ') % url + \
_('%s uses your email address'
' if you need to reset your password.') \
% g.site_title
h.flash_notice(msg, allow_html=True)
for facet in g.facets:
if facet in default_facet_titles:
facets[facet] = default_facet_titles[facet]
else:
facets[facet] = facet
return base.render('home/index.html', cache_force=True)
# gestion filtri/facets
for plugin in p.PluginImplementations(p.IFacets):
facets = plugin.dataset_facets(facets, 'dataset')
g.facet_titles = facets
data_dict = {
'q': '*:*',
'facet.field': list(facets.keys()),
'rows': 4,
'start': 0,
'sort': 'views_recent desc',
'fq': 'capacity:"public"'
}
query = logic.get_action('package_search')(context, data_dict)
g.search_facets = query['search_facets']
g.package_count = query['count']
g.datasets = query['results']
#print "c.search_facets: "
#print " ".join(c.search_facets)
except search.SearchError:
g.package_count = 0
if g.userobj and not g.userobj.email:
url = h.url_for('user.edit')
msg = _('Please <a href="%s">update your profile</a>'
' and add your email address. ') % url + \
_('%s uses your email address'
' if you need to reset your password.') \
% g.site_title
h.flash_notice(msg, allow_html=True)
return render_template('home/index.html', cache_force=True)

View File

@ -1,135 +1,118 @@
# encoding: utf-8
import re
import ckan.controllers.group as group
import ckan.plugins as plugins
import logging
import datetime
from urllib.parse import urlencode
from pylons.i18n import get_lang
import ckan.lib.base as base
import ckan.lib.helpers as h
import ckan.lib.maintain as maintain
import ckan.lib.navl.dictization_functions as dict_fns
import ckan.logic as logic
import ckan.lib.search as search
import ckan.model as model
import ckan.authz as authz
import ckan.lib.plugins
from flask import Blueprint, g, request, abort, render_template
import ckan.plugins as plugins
from ckan.common import OrderedDict, c, g, request, _
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
organization_vre = Blueprint("organization_vre", __name__)
''' The organization controller is for Organizations, which are implemented
as Groups with is_organization=True and group_type='organization'. It works
the same as the group controller apart from:
* templates and logic action/auth functions are sometimes customized
(switched using _replace_group_org)
* 'bulk_process' action only works for organizations
Nearly all the code for both is in the GroupController (for historical
reasons).
'''
Created by Francesco Mangiacrapa, see: #8964
'''
class OrganizationVREController(group.GroupController):
''' The organization controller is for Organizations, which are implemented
as Groups with is_organization=True and group_type='organization'. It works
the same as the group controller apart from:
* templates and logic action/auth functions are sometimes customized
(switched using _replace_group_org)
* 'bulk_process' action only works for organizations
Nearly all the code for both is in the GroupController (for historical
reasons).
'''
group_types = ['organization']
group_types = ['organization']
def _guess_group_type(expecting_name=False):
return 'organization'
def _guess_group_type(self, expecting_name=False):
return 'organization'
def _replace_group_org( string):
''' substitute organization for group if this is an org'''
return re.sub('^group', 'organization', string)
def _replace_group_org(self, string):
''' substitute organization for group if this is an org'''
return re.sub('^group', 'organization', string)
def _update_facet_titles(facets, group_type):
for plugin in plugins.PluginImplementations(plugins.IFacets):
facets = plugin.organization_facets(
facets, group_type, None)
def _update_facet_titles(self, facets, group_type):
for plugin in plugins.PluginImplementations(plugins.IFacets):
facets = plugin.organization_facets(
facets, group_type, None)
@organization_vre.route('/organization_vre')
def index():
group_type = _guess_group_type()
page = h.get_page_number(request.args) or 1
items_per_page = 21
context = {'model': model, 'session': model.Session,
'user': g.user, 'for_view': True,
'with_private': False}
q = g.q = request.params.get('q', '')
sort_by = g.sort_by_selected = request.args.get('sort')
try:
logic.check_access('site_read', context)
logic.check_access('group_list', context)
except NotAuthorized:
abort(403, _('Not authorized to see this page'))
# pass user info to context as needed to view private datasets of
# orgs correctly
if g.userobj:
context['user_id'] = g.userobj.id
context['user_is_admin'] = g.userobj.sysadmin
data_dict_global_results = {
'all_fields': False,
'q': q,
'sort': sort_by,
'type': group_type or 'group',
}
global_results = logic.get_action('group_list')(context,data_dict_global_results)
data_dict_page_results = {
'all_fields': True,
'q': q,
'sort': sort_by,
'type': group_type or 'group',
'limit': items_per_page,
'offset': items_per_page * (page - 1),
}
page_results = logic.get_action('group_list')(context, data_dict_page_results)
g.page = h.Page(
collection=global_results,
page=page,
url=h.pager_url,
items_per_page=items_per_page,
)
g.page.items = page_results
return render_template('organization_vre/index.html',
extra_vars={'group_type': group_type})
def index(self):
group_type = self._guess_group_type()
page = h.get_page_number(request.params) or 1
items_per_page = 21
context = {'model': model, 'session': model.Session,
'user': c.user, 'for_view': True,
'with_private': False}
q = c.q = request.params.get('q', '')
sort_by = c.sort_by_selected = request.params.get('sort')
try:
self._check_access('site_read', context)
self._check_access('group_list', context)
except NotAuthorized:
abort(403, _('Not authorized to see this page'))
# pass user info to context as needed to view private datasets of
# orgs correctly
if c.userobj:
context['user_id'] = c.userobj.id
context['user_is_admin'] = c.userobj.sysadmin
data_dict_global_results = {
'all_fields': False,
'q': q,
'sort': sort_by,
'type': group_type or 'group',
}
global_results = self._action('group_list')(context,
data_dict_global_results)
data_dict_page_results = {
'all_fields': True,
'q': q,
'sort': sort_by,
'type': group_type or 'group',
'limit': items_per_page,
'offset': items_per_page * (page - 1),
}
page_results = self._action('group_list')(context,
data_dict_page_results)
c.page = h.Page(
collection=global_results,
page=page,
url=h.pager_url,
items_per_page=items_per_page,
)
c.page.items = page_results
return base.render('organization_vre/index.html',
extra_vars={'group_type': group_type})
def read(self, id, limit=20):
group_type = self._ensure_controller_matches_group_type(
id.split('@')[0])
context = {'model': model, 'session': model.Session,
'user': c.user,
'schema': self._db_to_form_schema(group_type=group_type),
'for_view': True}
data_dict = {'id': id, 'type': group_type}
# unicode format (decoded from utf8)
c.q = request.params.get('q', '')
try:
# Do not query for the group datasets when dictizing, as they will
# be ignored and get requested on the controller anyway
data_dict['include_datasets'] = False
c.group_dict = self._action('group_show')(context, data_dict)
c.group = context['group']
except (NotFound, NotAuthorized):
abort(404, _('Group not found'))
self._read(id, limit, group_type)
return base.render('organization_vre/read.html',
extra_vars={'group_type': group_type})
@organization_vre.route('/organization_vre/<id>')
def read(id, limit=20):
#group_type = self._ensure_controller_matches_group_type(
# id.split('@')[0])
group_type = 'organization'
context = {'model': model, 'session': model.Session,
'user': g.user,
'schema': logic.schema.group_form_schema(),
'for_view': True}
data_dict = {'id': id, 'type': group_type}
# recupero eventuale query di ricerca
g.q = request.args.get('q', '')
try:
#i dataset non si includono nel risultato
data_dict['include_datasets'] = False
g.group_dict = logic.get_action('group_show')(context, data_dict)
g.group = context['group']
except (NotFound, NotAuthorized):
abort(404, _('Group not found'))
#read(id, limit, group_type)
return render_template('organization_vre/read.html',
extra_vars={'group_type': group_type})

View File

@ -1,88 +1,73 @@
import logging
import ckan.plugins as p
from ckan.common import OrderedDict, _, g, c
from ckan.common import OrderedDict, _
import ckan.lib.search as search
import ckan.model as model
import ckan.logic as logic
import ckan.lib.maintain as maintain
import ckan.lib.base as base
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 pylons.i18n import get_lang
from flask import Blueprint, render_template, g, request
import ckan.lib.base as base
import ckan.lib.navl.dictization_functions as dict_fns
import ckan.authz as authz
class d4STypeController(base.BaseController):
#Overriding controllers.HomeController.index method
def index(self):
try:
# package search
context = {'model': model, 'session': model.Session,'user': g.user, 'auth_user_obj': g.userobj}
facets = OrderedDict()
default_facet_titles = {
'organization': _('Organizations'),
'groups': _('Groups'),
'tags': _('Tags'),
'res_format': _('Formats'),
'license_id': _('Licenses'),
}
for facet in g.facets:
if facet in default_facet_titles:
facets[facet] = default_facet_titles[facet]
else:
facets[facet] = facet
# Facet titles
for plugin in p.PluginImplementations(p.IFacets):
facets = plugin.dataset_facets(facets, 'dataset')
g.facet_titles = facets
data_dict = {
'q': '*:*',
'facet.field': list(facets.keys()),
'rows': 4,
'start': 0,
'sort': 'views_recent desc',
'fq': 'capacity:"public"'
}
query = logic.get_action('package_search')(context, data_dict)
g.search_facets = query['search_facets']
g.package_count = query['count']
g.datasets = query['results']
#print "c.search_facets: "
#print " ".join(c.search_facets)
except search.SearchError:
g.package_count = 0
if g.userobj and not g.userobj.email:
#url = h.url_for(controller='user', action='edit') pylons
url = h.url_for('user.edit')
msg = _('Please <a href="%s">update your profile</a>'
' and add your email address. ') % url + \
_('%s uses your email address'
' if you need to reset your password.') \
% g.site_title
h.flash_notice(msg, allow_html=True)
#return base.render('type/index.html', cache_force=True) pylons
return render_template('type/index.html', cache_force=True)
d4s_type_blueprint = Blueprint('d4s_type', __name__)
@d4s_type_blueprint.route('/')
def index():
controller = d4STypeController()
return controller.index()
try:
# package search
context = {'model': model, 'session': model.Session,'user': g.user, 'auth_user_obj': g.userobj}
facets = OrderedDict()
default_facet_titles = {
'organization': _('Organizations'),
'groups': _('Groups'),
'tags': _('Tags'),
'res_format': _('Formats'),
'license_id': _('Licenses'),
}
for facet in g.facets:
if facet in default_facet_titles:
facets[facet] = default_facet_titles[facet]
else:
facets[facet] = facet
# Facet titles
for plugin in p.PluginImplementations(p.IFacets):
facets = plugin.dataset_facets(facets, 'dataset')
g.facet_titles = facets
data_dict = {
'q': '*:*',
'facet.field': list(facets.keys()),
'rows': 4,
'start': 0,
'sort': 'views_recent desc',
'fq': 'capacity:"public"'
}
query = logic.get_action('package_search')(context, data_dict)
g.search_facets = query['search_facets']
g.package_count = query['count']
g.datasets = query['results']
#print "c.search_facets: "
#print " ".join(c.search_facets)
except search.SearchError:
g.package_count = 0
if g.userobj and not g.userobj.email:
#url = h.url_for(controller='user', action='edit') pylons
url = h.url_for('user.edit')
msg = _('Please <a href="%s">update your profile</a>'
' and add your email address. ') % url + \
_('%s uses your email address'
' if you need to reset your password.') \
% g.site_title
h.flash_notice(msg, allow_html=True)
#return base.render('type/index.html', cache_force=True) pylons
return render_template('type/index.html', cache_force=True)

View File

@ -14,10 +14,6 @@ namespaces_dir = None
NAMESPACES_DIR_NAME = "namespaces_for_catalogue"
NAMESPACES_CACHE_FILENAME = "Namespaces_Catalogue_Categories.csv"
# Created by Francesco Mangiacrapa
# francesco.mangiacrapa@isti.cnr.it
# ISTI-CNR Pisa (ITALY)
# D4S_Cache_Controller
class D4S_Cache_Controller():

View File

@ -1,8 +1,3 @@
# Created by Francesco Mangiacrapa
# francesco.mangiacrapa@isti.cnr.it
# ISTI-CNR Pisa (ITALY)
## questo file va bene anche in p3 ##
import logging
log = logging.getLogger(__name__)

View File

@ -44,13 +44,8 @@ def reload_namespaces_from_IS(urlICProxy, resourceID, gcubeToken):
log.info("namespaces list read from IS is empty. Skipping caching update")
except Exception as e:
print("Error occurred on reading namespaces from IS and refilling the cache!")
print(e)
# Created by Francesco Mangiacrapa
# francesco.mangiacrapa@isti.cnr.it
# ISTI-CNR Pisa (ITALY)
log.error("Error occurred on reading namespaces from IS and refilling the cache!")
log.error(e)
# D4S_IS_DiscoveryCatalogueNamespacesController is used to discovery namespaces for Catalogue Categories (implemented as a Singleton)

View File

@ -7,11 +7,6 @@ NOCATEOGORY = 'nocategory'
log = logging.getLogger(__name__)
# Created by Francesco Mangiacrapa
# francesco.mangiacrapa@isti.cnr.it
# ISTI-CNR Pisa (ITALY)
# D4S_Namespaces_Extra_Util is used to get the extra fields indexed for D4Science namespaces
# @param: namespace_dict is the namespace dict of D4Science namespaces (defined in the Generic Resource: "Namespaces Catalogue Categories")
# @param: extras is the dictionary of extra fields for a certain item
@ -25,7 +20,7 @@ class D4S_Namespaces_Extra_Util():
dict_extras = None
nms = namespaceid + ":"
#has_namespace_ref = None
for key, value in extras:
for key, value in extras.items():
k = key
v = value
# print "key: " + k
@ -53,7 +48,7 @@ class D4S_Namespaces_Extra_Util():
#break
#ADDING ALL EXTRAS WITHOUT NAMESPACE
for key, value in extras:
for key, value in extras.items():
k = key
v = value

View File

@ -13,11 +13,6 @@ NAMESPACE_ID_LABEL = '@id'
log = logging.getLogger(__name__)
# Created by Francesco Mangiacrapa
# francesco.mangiacrapa@isti.cnr.it
# ISTI-CNR Pisa (ITALY)
def getResponseBody(uri):
req = urllib.request.Request(uri)
try:
@ -43,6 +38,12 @@ def getResponseBody(uri):
class D4S_IS_DiscoveryCatalogueNamespaces():
def __init__(self, urlICProxy, resourceID, gcubeToken):
if not isinstance(urlICProxy, str):
raise ValueError("urlICProxy must be a string")
if not isinstance(resourceID, str):
raise ValueError("resourceID must be a string")
if not isinstance(gcubeToken, str):
raise ValueError("gcubeToken must be a string")
self.urlICProxy = urlICProxy
self.resourceID = resourceID
self.gcubeToken = gcubeToken
@ -53,10 +54,6 @@ class D4S_IS_DiscoveryCatalogueNamespaces():
namespace_list = []
try:
# print("proxy: "+self.urlICProxy)
# print("resourceID: " + self.resourceID)
# print("gcubeTokenParam: " + gcubeTokenParam)
# print("gcubeToken: " + self.gcubeToken)
uri = self.urlICProxy + "/" + self.resourceID + "?" + gcubeTokenParam + "=" + self.gcubeToken
log.info("Contacting URL: %s" % uri)

View File

@ -26,14 +26,14 @@ def remove_check_replicated_custom_key(schema):
def _package_extras_save(extra_dicts, obj, context):
''' It can save repeated extras as key-value '''
allow_partial_update = context.get("allow_partial_update", False)
if extra_dicts is None and allow_partial_update:
#allow_partial_update = context.get("allow_partial_update", False) potrebbe non servire
if extra_dicts is None: #and allow_partial_update:
return
model = context["model"]
session = context["session"]
log.debug("extra_dicts: "+unicode(str(extra_dicts)).encode('utf-8'))
log.debug("extra_dicts: "+ str(extra_dicts))
#print "extra_dicts: "+str(extra_dicts)
extras_list = obj.extras_list
@ -59,118 +59,121 @@ def _package_extras_save(extra_dicts, obj, context):
if extra_dict['value'] is not None:
new_extras.setdefault(extra_dict["key"], []).append(extra_dict["value"])
log.debug("new_extras: "+unicode(str(new_extras)).encode('utf-8'))
log.debug("new_extras: "+ str(new_extras))
#print "new_extras: "+str(new_extras)
#new
#aggiunta di nuove chiavi
for key in set(new_extras.keys()) - set(old_extras.keys()):
state = 'active'
log.debug("adding key: "+unicode(key).encode('utf-8'))
#state = 'active'
log.debug("adding key: " + str(key))
#print "adding key: "+str(key)
extra_lst = new_extras[key]
for extra in extra_lst:
extra = model.PackageExtra(state=state, key=key, value=extra)
extra = model.PackageExtra(state='active', key=key, value=extra)
session.add(extra)
extras_list.append(extra)
#deleted
#gestione chiavi eliminate
for key in set(old_extras.keys()) - set(new_extras.keys()):
log.debug("deleting key: "+unicode(key).encode('utf-8'))
log.debug("deleting key: "+ str(key))
#print "deleting key: "+str(key)
extra_lst = extras[key]
for extra in extra_lst:
state = 'deleted'
extra.state = state
#state = 'deleted'
extra.state = 'deleted'
extras_list.remove(extra)
#changed
#gestione chiavi aggiornate
for key in set(new_extras.keys()) & set(old_extras.keys()):
#for each value of new list
for value in new_extras[key]:
old_occur = old_extras[key].count(value)
new_occur = new_extras[key].count(value)
log.debug("value: "+unicode(value).encode('utf-8') + ", new_occur: "+unicode(new_occur).encode('utf-8')+ ", old_occur: "+unicode(old_occur).encode('utf-8'))
log.debug("value: " + str(value) + ", new_occur: "+ str(new_occur)+ ", old_occur: "+ str(old_occur))
#print "value: "+str(value) + ", new_occur: "+str(new_occur) + ", old_occur: "+str(old_occur)
# it is an old value deleted or not
if value in old_extras[key]:
if old_occur == new_occur:
#print "extra - occurrences of: "+str(value) +", are equal into both list"
log.debug("extra - occurrences of: "+unicode(value).encode('utf-8') +", are equal into both list")
log.debug("extra - occurrences of: "+ str(value) +", are equal into both list")
#there is a little bug, this code return always the first element, so I'm fixing with #FIX-STATUS
extra_values = get_package_for_value(extras[key], value)
#extras_list.append(extra)
for extra in extra_values:
state = 'active'
extra.state = state
#state = 'active'
extra.state = 'active'
session.add(extra)
#print "extra updated: "+str(extra)
log.debug("extra updated: "+unicode(extra).encode('utf-8'))
log.debug("extra updated: "+ str(extra))
elif new_occur > old_occur:
#print "extra - a new occurrence of: "+str(value) +", is present into new list, adding it to old list"
log.debug("extra - a new occurrence of: "+unicode(value).encode('utf-8') +", is present into new list, adding it to old list")
state = 'active'
extra = model.PackageExtra(state=state, key=key, value=value)
extra.state = state
log.debug("extra - a new occurrence of: "+ str(value) + ", is present into new list, adding it to old list")
#state = 'active'
extra = model.PackageExtra(state='active', key=key, value=value)
#extra.state = state
#extra.state = 'active' non dovrebbe servire
session.add(extra)
extras_list.append(extra)
old_extras[key].append(value)
log.debug("old extra values updated: "+unicode(old_extras[key]).encode('utf-8'))
log.debug("old extra values updated: "+ str(old_extras[key]))
#print "old extra values updated: "+str(old_extras[key])
else:
#remove all occurrences deleted - this code could be optimized, it is run several times but could be performed one shot
countDelete = old_occur-new_occur
log.debug("extra - occurrence of: "+unicode(value).encode('utf-8')+", is not present into new list, removing "+unicode(countDelete).encode('utf-8')+" occurrence/s from old list")
log.debug("extra - occurrence of: "+ str(value).encode('utf-8') + ", is not present into new list, removing "+ str(countDelete).encode('utf-8')+" occurrence/s from old list")
#print "extra - occurrence of: "+str(value) +", is not present into new list, removing "+str(countDelete)+" occurrence/s from old list"
extra_values = get_package_for_value(extras[key], value)
for idx, extra in enumerate(extra_values):
if idx < countDelete:
#print "extra - occurrence of: "+str(value) +", is not present into new list, removing it from old list"
log.debug("pkg extra deleting: "+unicode(extra.value).encode('utf-8'))
log.debug("pkg extra deleting: "+ str(extra.value))
#print "pkg extra deleting: "+str(extra.value)
state = 'deleted'
extra.state = state
#state = 'deleted'
extra.state = 'deleted'
else:
#print "pkg extra reactivating: "+str(extra.value)
log.debug("pkg extra reactivating: "+unicode(extra.value).encode('utf-8'))
state = 'active'
extra.state = state
log.debug("pkg extra reactivating: "+ str(extra.value))
#state = 'active'
extra.state = 'active'
session.add(extra)
else:
#print "extra new value: "+str(value)
log.debug("extra new value: "+unicode(value).encode('utf-8'))
state = 'active'
extra = model.PackageExtra(state=state, key=key, value=value)
extra.state = state
log.debug("extra new value: " + str(value))
#state = 'active'
extra = model.PackageExtra(state='active', key=key, value=value)
#extra.state = state
#extra.state = 'active'
session.add(extra)
extras_list.append(extra)
#for each value of old list
#chiavi vecchie non presenti
for value in old_extras[key]:
#if value is not present in new list
if value not in new_extras[key]:
extra_values = get_package_for_value(extras[key], value)
for extra in extra_values:
#print "not present extra deleting: "+str(extra)
log.debug("not present extra deleting: "+unicode(extra).encode('utf-8'))
state = 'deleted'
extra.state = state
log.debug("not present extra deleting: "+ str(extra))
#state = 'deleted'
extra.state = 'deleted'
def get_package_for_value(list_package, value):
''' Returns a list of packages containing the value passed in input
'''
lst = []
for x in list_package:
if x.value == value:
lst.append(x)
else:
return lst
return lst
''' Returns a list of packages containing the value passed in input'''
return [x for x in list_package if x.value == value]
#lst = []
#for x in list_package:
# if x.value == value:
# lst.append(x)
# else:
# return lst
#
#return lst
#OVERRIDING BASE SQL ALCHEMY ENGINE INSTANCE
@ -189,7 +192,7 @@ def _init_TrackingMiddleware(self, app, config):
sqlalchemy_overflow = config.get('sqlalchemy.max_overflow')
if sqlalchemy_overflow is None:
sqlalchemy_overflow = 10;
sqlalchemy_overflow = 10
log.debug('sqlalchemy_overflow read: '+str(sqlalchemy_overflow))
@ -244,7 +247,7 @@ class D4SciencePlugin(plugins.SingletonPlugin):
def package_types(self):
# Aggiunta del tipo di dato personalizzato deliverable
return ['deliverable_type']
return []
def is_fallback(self):
# Indica che questo plugin può essere usato come fallback se un tipo specifico non è specificato