Changeset 9668 for main/waeup.kofa
- Timestamp:
- 17 Nov 2012, 12:35:46 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/reports.py
r9664 r9668 124 124 self.mode = mode 125 125 self.author = author 126 self._creation_dt_string = self.creation_dt.astimezone( 127 getUtility(IKofaUtils).tzinfo).strftime("%Y-%m-%d %H:%M:%S %Z") 126 128 self.data = get_students_by(session, mode) 127 129 128 130 def __repr__(self): 131 """Creates an executable representation of a StudentsReport object. 132 """ 129 133 return 'StudentsReport(%r, %r, author=%r)' % ( 130 134 self.args[0], self.mode, self.author) 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 ' % ( 142 self.session, self.mode, self._creation_dt_string) 131 143 132 144 def create_pdf(self): … … 134 146 table_data = tbl_data_to_table(*self.data) 135 147 col_widths = [None,] + [1.6*cm] * len(self.data[1]) + [None,] 136 creation_dt = self.creation_dt.astimezone(getUtility(IKofaUtils).tzinfo) 137 creation_dt = creation_dt.strftime("%Y-%m-%d %H:%M:%S %Z") 138 pdf_data = [Paragraph('<b>%s</b>' % creation_dt, 148 pdf_data = [Paragraph('<b>%s</b>' % self._creation_dt_string, 139 149 STYLE["Normal"]), 140 150 Spacer(1, 12),] … … 145 155 pdf_data, None, doc_title, self.author, 146 156 'Students in Session %s' % self.session) 147 open('/tmp/result.pdf', 'wb').write(pdf)148 157 return pdf 149 158
Note: See TracChangeset for help on using the changeset viewer.