Ignore:
Timestamp:
11 Jan 2015, 22:43:35 (10 years ago)
Author:
Henrik Bettermann
Message:

We need to provide unique filenames. Let's use the document id for the filename and not the download_name of the respective viewlet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/browser/fileviewlets.py

    r12386 r12444  
    109109    label = _(u'File')
    110110    title = _(u'Scan')
    111     download_name = u'filename.jpg'
     111    download_name = None
     112
     113    @property
     114    def download_filename(self):
     115        return u"%s.pdf" % self.context.document_id[:9]
    112116
    113117    @property
     
    131135    upload_button =_('Upload selected file')
    132136    delete_button = _('Delete')
     137
     138    @property
     139    def download_filename(self):
     140        return u"%s.pdf" % self.context.document_id[:9]
    133141
    134142    @property
     
    175183    """
    176184    grok.baseclass()
    177     grok.name('none.jpg')
    178     download_name = u'none.jpg'
     185    download_name = None
     186
     187    @property
     188    def download_filename(self):
     189        return u"%s.pdf" % self.context.document_id[:9]
    179190
    180191    def render(self):
     
    198209        elif ext == '.tif':
    199210            self.response.setHeader('Content-Type', 'image/tiff')
     211        if self.download_filename:
     212            self.response.setHeader('Content-Disposition',
     213                'attachment; filename="%s' % self.download_filename)
    200214        return image
Note: See TracChangeset for help on using the changeset viewer.