admin: don't fail if category does not exist (#57366)
gitea-wip/wcs/pipeline/head There was a failure building this commit
Details
gitea-wip/wcs/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
ca121d4bf1
commit
643e321ca0
|
@ -95,6 +95,8 @@ def test_categories_edit(pub):
|
|||
|
||||
assert Category.get(1).description == 'category description'
|
||||
|
||||
app.get('/backoffice/forms/categories/foo-bar/', status=404)
|
||||
|
||||
|
||||
def test_categories_edit_duplicate_name(pub):
|
||||
Category.wipe()
|
||||
|
|
|
@ -23,7 +23,7 @@ from wcs.categories import CardDefCategory, Category, WorkflowCategory
|
|||
from wcs.formdef import FormDef
|
||||
from wcs.qommon import _, misc, template
|
||||
from wcs.qommon.backoffice.menu import html_top
|
||||
from wcs.qommon.errors import AccessForbiddenError
|
||||
from wcs.qommon.errors import AccessForbiddenError, TraversalError
|
||||
from wcs.qommon.form import Form, HtmlWidget, SingleSelectWidget, StringWidget, WidgetList, WysiwygTextWidget
|
||||
from wcs.workflows import Workflow
|
||||
|
||||
|
@ -163,7 +163,10 @@ class CategoryPage(Directory):
|
|||
do_not_call_in_templates = True
|
||||
|
||||
def __init__(self, component):
|
||||
self.category = self.category_class.get(component)
|
||||
try:
|
||||
self.category = self.category_class.get(component)
|
||||
except KeyError:
|
||||
raise TraversalError()
|
||||
self.category_ui = self.category_ui_class(self.category)
|
||||
get_response().breadcrumb.append((component + '/', self.category.name))
|
||||
|
||||
|
|
Loading…
Reference in New Issue