mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-29 03:46:25 -06:00
Hide traceback from rendered device config
When an exception occurs during device configuration rendering, it usually doesn't contain information about the template being rendered, but rather the trace of how the template was rendered. Since this could confuse users and expose internal server information, it is now hidden.
This commit is contained in:
parent
24b76792a9
commit
4cb6abfc18
@ -1,5 +1,3 @@
|
||||
import traceback
|
||||
|
||||
from django.contrib import messages
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.core.paginator import EmptyPage, PageNotAnInteger
|
||||
@ -2128,8 +2126,9 @@ class DeviceRenderConfigView(generic.ObjectView):
|
||||
try:
|
||||
rendered_config = config_template.render(context=context_data)
|
||||
except TemplateError as e:
|
||||
messages.error(request, _("An error occurred while rendering the template: {error}").format(error=e))
|
||||
rendered_config = traceback.format_exc()
|
||||
msg = _("An error occurred while rendering the template: {error}").format(error=e)
|
||||
messages.error(request, msg)
|
||||
rendered_config = msg
|
||||
|
||||
return {
|
||||
'config_template': config_template,
|
||||
|
Loading…
Reference in New Issue
Block a user