Removed task-specific nice 404 page (it's not on Pillar level for all nodes)
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from flask import Blueprint, render_template, request, current_app
|
from flask import Blueprint, render_template, request, current_app
|
||||||
@@ -7,7 +6,6 @@ import flask_login
|
|||||||
import werkzeug.exceptions as wz_exceptions
|
import werkzeug.exceptions as wz_exceptions
|
||||||
|
|
||||||
import pillarsdk
|
import pillarsdk
|
||||||
import pillarsdk.exceptions as sdk_exceptions
|
|
||||||
from pillar.web.system_util import pillar_api
|
from pillar.web.system_util import pillar_api
|
||||||
import pillar.api.utils
|
import pillar.api.utils
|
||||||
import pillar.web.subquery
|
import pillar.web.subquery
|
||||||
@@ -65,22 +63,7 @@ def view_task(project, attract_props, task_id):
|
|||||||
raise wz_exceptions.Forbidden()
|
raise wz_exceptions.Forbidden()
|
||||||
|
|
||||||
api = pillar_api()
|
api = pillar_api()
|
||||||
try:
|
task = pillarsdk.Node.find(task_id, api=api)
|
||||||
task = pillarsdk.Node.find(task_id, api=api)
|
|
||||||
except sdk_exceptions.ResourceNotFound as ex:
|
|
||||||
content = getattr(ex, 'content', None)
|
|
||||||
if content:
|
|
||||||
deleted_task = json.loads(content)
|
|
||||||
if deleted_task and deleted_task.get('_deleted', False):
|
|
||||||
# This task used to exist, but doesn't any more. Let the user know.
|
|
||||||
task_name = deleted_task.get('name')
|
|
||||||
if task_name:
|
|
||||||
description = u'Task "%s" was deleted.' % task_name
|
|
||||||
else:
|
|
||||||
description = u'This task was deleted.'
|
|
||||||
return render_template('errors/404_embed.html', description=description), 404
|
|
||||||
raise
|
|
||||||
|
|
||||||
node_type = project.get_node_type(node_type_task['name'])
|
node_type = project.get_node_type(node_type_task['name'])
|
||||||
|
|
||||||
# Fetch project users so that we can assign them tasks
|
# Fetch project users so that we can assign them tasks
|
||||||
|
Reference in New Issue
Block a user