Ignore:
Timestamp:
12 Jan 2015, 09:18:36 (10 years ago)
Author:
Henrik Bettermann
Message:

Remove redundant code and set download_filename only for pdf files.

File:
1 edited

Legend:

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

    r12444 r12446  
    106106    grok.viewletmanager(FileManager)
    107107    template = default_filedisplay_template
    108     grok.order(1)
    109108    label = _(u'File')
    110109    title = _(u'Scan')
    111     download_name = None
    112 
    113     @property
    114     def download_filename(self):
    115         return u"%s.pdf" % self.context.document_id[:9]
    116110
    117111    @property
     
    135129    upload_button =_('Upload selected file')
    136130    delete_button = _('Delete')
    137 
    138     @property
    139     def download_filename(self):
    140         return u"%s.pdf" % self.context.document_id[:9]
    141131
    142132    @property
     
    183173    """
    184174    grok.baseclass()
    185     download_name = None
    186 
    187     @property
    188     def download_filename(self):
    189         return u"%s.pdf" % self.context.document_id[:9]
    190175
    191176    def render(self):
     
    205190        elif ext == '.png':
    206191            self.response.setHeader('Content-Type', 'image/png')
     192        elif ext == '.tif':
     193            self.response.setHeader('Content-Type', 'image/tiff')
    207194        elif ext == '.pdf':
    208195            self.response.setHeader('Content-Type', 'application/pdf')
    209         elif ext == '.tif':
    210             self.response.setHeader('Content-Type', 'image/tiff')
    211         if self.download_filename:
    212196            self.response.setHeader('Content-Disposition',
    213                 'attachment; filename="%s' % self.download_filename)
     197                'attachment; filename="%s.pdf' % self.download_filename)
    214198        return image
Note: See TracChangeset for help on using the changeset viewer.