Changeset 9670 for main/waeup.kofa/trunk/src/waeup/kofa/students
- Timestamp:
- 17 Nov 2012, 20:47:02 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/reports.py
r9668 r9670 134 134 self.args[0], self.mode, self.author) 135 135 136 def __str__(self): 137 """A nice human readable representation of a StudentsReport. 138 139 Includes infos about session, mode and creation datetime. 140 """ 141 return 'Students Report [session=%s, mode=%s] of %s ' % ( 136 #def __str__(self): 137 # """A nice human readable representation of a StudentsReport. 138 139 # Includes infos about session, mode and creation datetime. 140 # """ 141 # return 'Students Report [session=%s, mode=%s] of %s ' % ( 142 # self.session, self.mode, self._creation_dt_string) 143 144 @property 145 def title(self): 146 title = 'StudentsReport_%s_%s_%s' % ( 142 147 self.session, self.mode, self._creation_dt_string) 148 title = title.replace('/', '_').replace(' ','_') 149 return title 143 150 144 151 def create_pdf(self): … … 234 241 235 242 def render(self): 236 filename = "%s.pdf" % (self.context. __repr__())243 filename = "%s.pdf" % (self.context.title) 237 244 self.response.setHeader( 238 245 'Content-Type', 'application/pdf') -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_reports.py
r9669 r9670 33 33 return 34 34 35 def test_str(self): 36 # StudentsReport provide a nice string representation 35 #def test_str(self): 36 # # StudentsReport provide a nice string representation 37 # obj = StudentsReport(2010, 'Undergraduate Full-Time', author='Bob') 38 # self.assertEqual( 39 # obj.__str__()[:65], 40 # 'Students Report ' 41 # '[session=2010/2011, mode=Undergraduate Full-Time]') 42 # return 43 44 def test_title(self): 37 45 obj = StudentsReport(2010, 'Undergraduate Full-Time', author='Bob') 38 self.assertEqual( 39 obj.__str__()[:65], 40 'Students Report ' 41 '[session=2010/2011, mode=Undergraduate Full-Time]') 46 self.assertTrue( 47 obj.title.startswith( 48 'StudentsReport_2010_2011_Undergraduate_Full-Time_')) 42 49 return 43 50
Note: See TracChangeset for help on using the changeset viewer.