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.

Location:
main/waeup.ikoba/trunk/src/waeup/ikoba/browser
Files:
3 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
  • main/waeup.ikoba/trunk/src/waeup/ikoba/browser/templates/filedisplay.pt

    r12242 r12444  
    55  <td>
    66    <a tal:attributes="href python: view.url(context, viewlet.download_name)"
    7        tal:content="viewlet/download_name"
     7       tal:content="viewlet/download_filename"
    88       target="image">
    99      LINK
  • main/waeup.ikoba/trunk/src/waeup/ikoba/browser/templates/fileupload.pt

    r11949 r12444  
    77    <tal:file tal:condition="viewlet/file_exists">
    88      <a tal:attributes="href python: view.url(context, viewlet.download_name)"
    9          tal:content="viewlet/title"
     9         tal:content="viewlet/download_filename"
    1010         target="image">
    1111        LINK
Note: See TracChangeset for help on using the changeset viewer.