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
|
@Lazy
|
||||||
def xeditable(self):
|
def xeditable(self):
|
||||||
|
if self.typeOptions('no_external_edit'):
|
||||||
|
return False
|
||||||
ct = getattr(self.context, 'contentType', '')
|
ct = getattr(self.context, 'contentType', '')
|
||||||
if not ct or ct in ('application/pdf', 'application/x-pdf'):
|
if not ct or ct in ('application/pdf', 'application/x-pdf'):
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -207,7 +207,8 @@ class ResourceView(BaseView):
|
||||||
data = context.data
|
data = context.data
|
||||||
if useAttachment:
|
if useAttachment:
|
||||||
filename = adapted(self.context).localFilename or getName(self.context)
|
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',
|
response.setHeader('Content-Disposition',
|
||||||
'attachment; filename=%s' % filename)
|
'attachment; filename=%s' % filename)
|
||||||
response.setHeader('Content-Length', len(data))
|
response.setHeader('Content-Length', len(data))
|
||||||
|
|
Loading…
Add table
Reference in a new issue