Changeset 9673 for main/waeup.kofa/trunk/src
- Timestamp:
- 17 Nov 2012, 23:43:02 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/reports.py
r9672 r9673 52 52 """ 53 53 title = Attribute("""Human readable description of report type.""") 54 54 55 def generate(site, args=[], kw={}): 55 56 """Generate a report. … … 157 158 class Report(object): 158 159 creation_dt = None 159 160 @property161 def title(self):162 return _(u'A report')163 160 164 161 def __init__(self, args=[], kwargs={}): -
main/waeup.kofa/trunk/src/waeup/kofa/students/reports.py
r9672 r9673 128 128 self.data = get_students_by(session, mode) 129 129 130 @property131 def title(self):132 title = 'StudentsReport_%s_%s_%s' % (133 self.session, self.mode, self._creation_dt_string)134 title = title.replace('/', '_').replace(' ','_')135 return title136 137 130 def create_pdf(self): 138 131 creator = getUtility(IPDFCreator) … … 223 216 224 217 def render(self): 225 filename = "%s.pdf" % (self.context.title) 218 filename = 'StudentsReport_%s_%s_%s.pdf' % ( 219 self.context.session, self.context.mode, 220 self._creation_dt_string) 221 filename = filename.replace( 222 '/', '_').replace(' ','_').replace(':', '-') 226 223 self.response.setHeader( 227 224 'Content-Type', 'application/pdf') -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_reports.py
r9672 r9673 19 19 verifyClass(IStudentsReport, StudentsReport) 20 20 verifyObject(IStudentsReport, obj) 21 return22 23 def test_title(self):24 obj = StudentsReport(2010, 'Undergraduate Full-Time', author='Bob')25 self.assertTrue(26 obj.title.startswith(27 'StudentsReport_2010_2011_Undergraduate_Full-Time_'))28 21 return 29 22
Note: See TracChangeset for help on using the changeset viewer.