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/documents
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/documents/document.py

    r12442 r12444  
    146146    form_fields_interface = IPDFDocument
    147147
    148     filenames = ('scan.pdf',)
     148    filenames = ('file.pdf',)
    149149
    150150PDFDocument = attrs_to_fields(PDFDocument)
  • main/waeup.ikoba/trunk/src/waeup/ikoba/documents/fileviewlets.py

    r12243 r12444  
    4040    title = _(u'PDF File')
    4141    mus = 1024 * 200
    42     download_name = u'sample.pdf'
     42    download_name = u'file.pdf'
    4343    tab_redirect = '#tab2'
    4444
     
    5353    label = _(u'PDF Scan')
    5454    title = _(u'PDF Scan')
    55     download_name = u'sample.pdf'
     55    download_name = u'file.pdf'
    5656
    5757
     
    5959    """Scan document.
    6060    """
    61     ##: Needs to be protected if not published
    62     grok.name('sample.pdf')
     61    grok.name('file.pdf')
    6362    grok.context(PDFDocument)
    6463    grok.require('waeup.Public')
    65     download_name = u'sample.pdf'
     64    download_name = u'file.pdf'
    6665
    6766    def update(self):
  • main/waeup.ikoba/trunk/src/waeup/ikoba/documents/tests/test_browser.py

    r12442 r12444  
    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/file.pdf">DOC1.pdf</a>'
    151151            in self.browser.contents)
    152152        # The file can be found in the file system
    153153        file = getUtility(IExtFileStore).getFileByContext(
    154             document, attr='sample.pdf')
     154            document, attr='file.pdf')
    155155        file_content = file.read()
    156156        pdf.seek(0)
     
    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'
    164164            in self.browser.contents)
    165165        IWorkflowState(document).setState(PUBLISHED)
    166         self.browser.open(self.container_path + '/DOC1/sample.pdf')
     166        self.browser.open(self.container_path + '/DOC1/file.pdf')
    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
     
    186190        # File has been removed too
    187191        file = getUtility(IExtFileStore).getFileByContext(
    188             document, attr='sample.pdf')
     192            document, attr='file.pdf')
    189193        self.assertTrue(file is None)
    190194
     
    204208            % document.document_id in logcontent)
    205209        self.assertTrue(
    206             'INFO - zope.mgr - documents.browser.DocumentManageFormPage - %s - uploaded: sample.pdf (my_sample_scan.pdf)'
     210            'INFO - zope.mgr - documents.browser.DocumentManageFormPage - %s - uploaded: file.pdf (my_sample_scan.pdf)'
    207211            % document.document_id in logcontent)
    208212        self.assertTrue(
Note: See TracChangeset for help on using the changeset viewer.