new options for resources: suppress external editing, do not normalize filename on download
This commit is contained in:
parent
f62a907590
commit
6bb4f35091
2 changed files with 4 additions and 1 deletions
|
@ -671,6 +671,8 @@ class BaseView(GenericView, I18NView):
|
|||
|
||||
@Lazy
|
||||
def xeditable(self):
|
||||
if self.typeOptions('no_external_edit'):
|
||||
return False
|
||||
ct = getattr(self.context, 'contentType', '')
|
||||
if not ct or ct in ('application/pdf', 'application/x-pdf'):
|
||||
return False
|
||||
|
|
|
@ -207,7 +207,8 @@ class ResourceView(BaseView):
|
|||
data = context.data
|
||||
if useAttachment:
|
||||
filename = adapted(self.context).localFilename or getName(self.context)
|
||||
filename = NameChooser(getParent(self.context)).normalizeName(filename)
|
||||
if not self.typeOptions('no_normalize_download_filename'):
|
||||
filename = NameChooser(getParent(self.context)).normalizeName(filename)
|
||||
response.setHeader('Content-Disposition',
|
||||
'attachment; filename=%s' % filename)
|
||||
response.setHeader('Content-Length', len(data))
|
||||
|
|
Loading…
Add table
Reference in a new issue