Changeset 13264 for main/waeup.ikoba/trunk/src/waeup/ikoba/documents
- Timestamp:
- 17 Sep 2015, 08:33:26 (9 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba/documents
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/fileviewlets.py
r12458 r13264 18 18 19 19 import grok 20 from zope.component import getUtility 21 from waeup.ikoba.interfaces import IExtFileStore 20 22 from waeup.ikoba.interfaces import MessageFactory as _ 21 23 from waeup.ikoba.interfaces import PUBLISHED … … 23 25 from waeup.ikoba.browser.fileviewlets import ( 24 26 FileDisplay, FileUpload, Image) 27 from waeup.ikoba.utils.helpers import file_size 25 28 26 29 from waeup.ikoba.documents.document import PDFDocument … … 45 48 @property 46 49 def download_filename(self): 47 return u"%s.pdf" % self.context.document_id 50 file = getUtility(IExtFileStore).getFileByContext( 51 self.context, attr=self.download_name) 52 fs = file_size(file)/1024.0 53 return u"%s.pdf (%.1f kB)" % (self.context.document_id, fs) 48 54 49 55 … … 61 67 @property 62 68 def download_filename(self): 63 return u"%s.pdf" % self.context.document_id 69 file = getUtility(IExtFileStore).getFileByContext( 70 self.context, attr=self.download_name) 71 fs = file_size(file)/1024.0 72 return u"%s.pdf (%.1f kB)" % (self.context.document_id, fs) 64 73 65 74 -
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/tests/test_browser.py
r13139 r13264 147 147 self.browser.getControl( 148 148 name='upload_pdfscanmanageupload').click() 149 self.assertTrue( 150 'href="http://localhost/app/documents/DOC1/file.pdf">DOC1.pdf</a>' 149 # The file size is shown 150 self.assertTrue( 151 'href="http://localhost/app/documents/DOC1/file.pdf">DOC1.pdf (23.7 kB)</a>' 152 in self.browser.contents) 153 # Also on display page the file size is displayed. 154 self.browser.open(self.container_path + '/DOC1') 155 self.assertTrue( 156 'href="http://localhost/app/documents/DOC1/file.pdf">DOC1.pdf (23.7 kB)</a>' 151 157 in self.browser.contents) 152 158 # The file can be found in the file system
Note: See TracChangeset for help on using the changeset viewer.