new options for resources: suppress external editing, do not normalize filename on download

This commit is contained in:
Helmut Merz 2012-03-14 16:42:53 +01:00
parent f62a907590
commit 6bb4f35091
2 changed files with 4 additions and 1 deletions

View file

@ -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

View file

@ -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))