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

Remove redundant code and set download_filename for pdf files.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/documents
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/documents/fileviewlets.py

    r12438 r12447  
    4444    tab_redirect = '#tab2'
    4545
     46    @property
     47    def download_filename(self):
     48        return u"%s.pdf" % self.context.document_id
     49
    4650
    4751class PDFScanDisplay(FileDisplay):
     
    5660    download_name = u'sample.pdf'
    5761
     62    @property
     63    def download_filename(self):
     64        return u"%s.pdf" % self.context.document_id
     65
    5866
    5967class PDFScanImage(UtilityView, Image):
     
    6674    download_name = u'sample.pdf'
    6775
     76    @property
     77    def download_filename(self):
     78        return self.context.document_id
     79
    6880    def update(self):
    6981        if self.context.state != PUBLISHED:
  • main/waeup.kofa/trunk/src/waeup/kofa/documents/tests/test_browser.py

    r12441 r12447  
    148148            name='upload_pdfscanmanageupload').click()
    149149        self.assertTrue(
    150             'href="http://localhost/app/documents/DOC1/sample.pdf">PDF File</a>'
     150            'href="http://localhost/app/documents/DOC1/sample.pdf">DOC1.pdf</a>'
    151151            in self.browser.contents)
    152152        # The file can be found in the file system
     
    159159        # Browsing the link shows a real pdf only if the document
    160160        # has been published
    161         self.browser.getLink("PDF File").click()
     161        self.browser.getLink("DOC1.pdf").click()
    162162        self.assertTrue(
    163163            'The document requested has not yet been published'
     
    167167        self.assertEqual(
    168168            self.browser.headers['content-type'], 'application/pdf')
     169        # The name of the downloaded file will be different
     170        self.assertEqual(
     171            self.browser.headers['Content-Disposition'],
     172            'attachment; filename="DOC1.pdf')
    169173
    170174        # Transitions can be performed
Note: See TracChangeset for help on using the changeset viewer.