Commit 3ac1d702 authored by Romain Courteaud's avatar Romain Courteaud

Raise a 403 error when a convertion is not accessible.

This prevent triggering authentification popup on the browser side (in case of
Unauthorized error) which make the UI not usable.
parent a09f06d6
......@@ -32,6 +32,7 @@ from Products.ERP5Type.Utils import fill_args_from_request
from Products.CMFCore.utils import getToolByName, _setCacheHeaders,\
_ViewEmulator
import warnings
from zExceptions import Forbidden
_MARKER = []
......@@ -79,6 +80,9 @@ class DownloadableMixin:
if format is _MARKER:
format = None
self._checkConversionFormatPermission(format, **kw)
if not self.checkConversionFormatPermission(format, **kw):
raise Forbidden('You are not allowed to get this document in this ' \
'format')
mime, data = self.convert(format, **kw)
output_format = None
if not format:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment