Ignore:
Timestamp:
15 Dec 2014, 07:44:01 (10 years ago)
Author:
Henrik Bettermann
Message:

Protect pdf download if document has not been published.

Add workflow transition 'retract'.

File:
1 edited

Legend:

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

    r12225 r12240  
    1919import grok
    2020from waeup.ikoba.interfaces import MessageFactory as _
    21 
     21from waeup.ikoba.interfaces import PUBLISHED
     22from waeup.ikoba.browser.layout import UtilityView
    2223from waeup.ikoba.browser.fileviewlets import (
    2324    FileDisplay, FileUpload, Image)
     
    5556
    5657
    57 class PDFScanImage(Image):
     58class PDFScanImage(Image, UtilityView):
    5859    """Scan document.
    5960    """
     
    6465    download_name = u'sample.pdf'
    6566
     67    def render(self):
     68        if self.context.state != PUBLISHED:
     69            self.flash(_('The document requested has not yet been published.'),
     70                type="warning")
     71            self.redirect(self.url(self.context))
     72            return
     73        return super(PDFScanImage, self).render()
     74
Note: See TracChangeset for help on using the changeset viewer.