forked from enviPath/enviPy
Fixed error return, removed unused options
This commit is contained in:
@ -8,7 +8,7 @@ from django.shortcuts import redirect
|
||||
from bayer.models import PESCompound
|
||||
from epdb.logic import PackageManager
|
||||
from epdb.models import Pathway, Node
|
||||
from epdb.views import _anonymous_or_real
|
||||
from epdb.views import _anonymous_or_real, error
|
||||
from utilities.decorators import package_permission_required
|
||||
|
||||
Package = s.GET_PACKAGE_MODEL()
|
||||
@ -22,7 +22,11 @@ def create_pes(request, package_uuid):
|
||||
if request.method == "POST":
|
||||
|
||||
if current_package.classification_level == Package.Classification.INTERNAL:
|
||||
raise HttpResponseBadRequest("Cannot create PESs for internal packages.")
|
||||
return error(
|
||||
request,
|
||||
f'Creation of PESs for package {current_package.name} failed!',
|
||||
"Creating PESs for internal packages is not allowed.",
|
||||
)
|
||||
|
||||
compound_name = request.POST.get('compound-name')
|
||||
compound_description = request.POST.get('compound-description')
|
||||
@ -64,7 +68,11 @@ def create_pes_node(request, package_uuid, pathway_uuid):
|
||||
if request.method == "POST":
|
||||
|
||||
if current_package.classification_level == Package.Classification.INTERNAL:
|
||||
raise HttpResponseBadRequest("Cannot create PESs for internal packages.")
|
||||
return error(
|
||||
request,
|
||||
f'Creation of PESs for package {current_package.name} failed!',
|
||||
"Creating PESs for internal packages is not allowed.",
|
||||
)
|
||||
|
||||
compound_name = request.POST.get('compound-name')
|
||||
compound_description = request.POST.get('compound-description')
|
||||
|
||||
Reference in New Issue
Block a user