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.

Location:
main/waeup.ikoba/trunk/src/waeup/ikoba
Files:
3 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
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/fileviewlets.py

    r12444 r12446  
    9292    mus = 1024 * 200
    9393    download_name = u'sample'
     94    download_filename = download_name
    9495    tab_redirect = '#tab2'
    9596
     
    115116    title = _(u'Sample Scan')
    116117    download_name = u'sample'
     118    download_filename = download_name
    117119
    118120
     
    120122    """Scan document.
    121123    """
     124
    122125    grok.name('sample')
    123126    grok.context(CustomerSampleDocument)
    124127    grok.require('waeup.viewCustomer')
    125128    download_name = u'sample'
     129    download_filename = download_name
    126130
    127131
     
    141145    download_name = u'sample.pdf'
    142146    tab_redirect = '#tab2'
     147
     148    @property
     149    def download_filename(self):
     150        return u"%s.pdf" % self.context.document_id[:9]
    143151
    144152
     
    161169    download_name = u'sample.pdf'
    162170
     171    @property
     172    def download_filename(self):
     173        return u"%s.pdf" % self.context.document_id[:9]
     174
    163175
    164176class PDFScanImage(Image):
     
    170182    download_name = u'sample.pdf'
    171183
     184    @property
     185    def download_filename(self):
     186        return u"%s" % self.context.document_id[:9]
     187
    172188
    173189class PDFScanSlip(PDFScanDisplay):
  • main/waeup.ikoba/trunk/src/waeup/ikoba/documents/fileviewlets.py

    r12444 r12446  
    4343    tab_redirect = '#tab2'
    4444
     45    @property
     46    def download_filename(self):
     47        return u"%s.pdf" % self.context.document_id[:9]
     48
    4549
    4650class PDFScanDisplay(FileDisplay):
     
    5559    download_name = u'file.pdf'
    5660
     61    @property
     62    def download_filename(self):
     63        return u"%s.pdf" % self.context.document_id[:9]
     64
    5765
    5866class PDFScanImage(UtilityView, Image):
     
    6472    download_name = u'file.pdf'
    6573
     74    @property
     75    def download_filename(self):
     76        return u"%s" % self.context.document_id[:9]
     77
    6678    def update(self):
    6779        if self.context.state != PUBLISHED:
Note: See TracChangeset for help on using the changeset viewer.