Changeset 12240
- Timestamp:
- 15 Dec 2014, 07:44:01 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba/documents
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/fileviewlets.py
r12225 r12240 19 19 import grok 20 20 from waeup.ikoba.interfaces import MessageFactory as _ 21 21 from waeup.ikoba.interfaces import PUBLISHED 22 from waeup.ikoba.browser.layout import UtilityView 22 23 from waeup.ikoba.browser.fileviewlets import ( 23 24 FileDisplay, FileUpload, Image) … … 55 56 56 57 57 class PDFScanImage(Image ):58 class PDFScanImage(Image, UtilityView): 58 59 """Scan document. 59 60 """ … … 64 65 download_name = u'sample.pdf' 65 66 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 -
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/tests/test_browser.py
r12239 r12240 37 37 from waeup.ikoba.app import Company 38 38 from waeup.ikoba.interfaces import ( 39 IUserAccount, IJobManager, APPROVED, SUBMITTED, 39 IUserAccount, IJobManager, APPROVED, SUBMITTED, PUBLISHED, 40 40 IFileStoreNameChooser, IExtFileStore, IFileStoreHandler) 41 41 from waeup.ikoba.imagestorage import ( … … 151 151 'href="http://localhost/app/documents/d101/sample.pdf">PDF File</a>' 152 152 in self.browser.contents) 153 # Browsing the link shows a real pdf 154 self.browser.open('sample.pdf') 153 # Browsing the link shows a real pdf only if the document 154 # has been published 155 self.browser.getLink("PDF File").click() 156 self.assertTrue( 157 'The document requested has not yet been published' 158 in self.browser.contents) 159 IWorkflowState(document).setState(PUBLISHED) 160 self.browser.getLink("sample.pdf").click() 155 161 self.assertEqual( 156 162 self.browser.headers['content-type'], 'application/pdf') 157 163 158 164 # Transitions can be performed 165 self.assertEqual(document.state, 'published') 159 166 self.browser.open(self.container_path + '/d101') 160 167 self.browser.getLink("Transition").click() 161 self.browser.getControl(name="transition").value = [' publish']168 self.browser.getControl(name="transition").value = ['retract'] 162 169 self.browser.getControl("Save").click() 163 self.assertEqual(document.state, ' published')170 self.assertEqual(document.state, 'created') 164 171 165 172 # Documents can be removed … … 189 196 % document.document_id in logcontent) 190 197 self.assertTrue( 191 'INFO - zope.mgr - %s - Document published' % document.document_id198 'INFO - zope.mgr - %s - Document retracted' % document.document_id 192 199 in logcontent) 193 200 self.assertTrue( -
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/workflow.py
r12222 r12240 48 48 msg = _('Document published'), 49 49 destination = PUBLISHED), 50 51 Transition( 52 transition_id = 'retract', 53 title = _('Retract documet'), 54 source = PUBLISHED, 55 condition = NullCondition, 56 msg = _('Document retracted'), 57 destination = CREATED), 50 58 ) 51 59
Note: See TracChangeset for help on using the changeset viewer.