Changeset 10550 for main/waeup.kofa/trunk/src
- Timestamp:
- 28 Aug 2013, 09:43:00 (11 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students/reports
- Files:
-
- 2 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/reports/student_reports.py
r10547 r10550 26 26 from waeup.kofa.reports import IReport 27 27 28 class IStudent sReport(IReport):28 class IStudentStatisticsReport(IReport): 29 29 30 30 session = Attribute('Session to report') … … 118 118 ] 119 119 120 @implementer(IStudent sReport)121 class Student sReport(Report):120 @implementer(IStudentStatisticsReport) 121 class StudentStatisticsReport(Report): 122 122 data = None 123 123 session = None … … 125 125 126 126 def __init__(self, session, mode, author='System'): 127 super(Student sReport, self).__init__(127 super(StudentStatisticsReport, self).__init__( 128 128 args=[session, mode], kwargs={'author':author}) 129 129 self.session = academic_sessions_vocab.getTerm(session).title … … 150 150 151 151 @implementer(IReportGenerator) 152 class Student sReportGenerator(grok.GlobalUtility):152 class StudentStatisticsReportGenerator(grok.GlobalUtility): 153 153 154 154 title = _('Students') … … 156 156 157 157 def generate(self, site, session=None, mode=None, author=None): 158 result = Student sReport(session=session, mode=mode, author=author)158 result = StudentStatisticsReport(session=session, mode=mode, author=author) 159 159 return result 160 160 … … 168 168 from waeup.kofa.reports import get_generators 169 169 grok.templatedir('browser_templates') 170 class Student sReportGeneratorPage(KofaPage):171 172 grok.context(Student sReportGenerator)170 class StudentStatisticsReportGeneratorPage(KofaPage): 171 172 grok.context(StudentStatisticsReportGenerator) 173 173 grok.name('index.html') 174 174 grok.require('waeup.manageReports') … … 215 215 return 216 216 217 class Student sReportPDFView(grok.View):218 219 grok.context(IStudent sReport)217 class StudentStatisticsReportPDFView(grok.View): 218 219 grok.context(IStudentStatisticsReport) 220 220 grok.name('pdf') 221 221 grok.require('waeup.Public') 222 222 223 223 def render(self): 224 filename = 'Student sReport_%s_%s_%s.pdf' % (224 filename = 'StudentStatisticsReport_%s_%s_%s.pdf' % ( 225 225 self.context.session, self.context.mode, 226 226 self.context.creation_dt_string) -
main/waeup.kofa/trunk/src/waeup/kofa/students/reports/tests/test_student_reports.py
r10547 r10550 5 5 from zope.component import getUtility 6 6 from waeup.kofa.interfaces import IJobManager 7 from waeup.kofa.students.reports import (8 get_students_by, Student sReport, IStudentsReport)7 from waeup.kofa.students.reports.student_reports import ( 8 get_students_by, StudentStatisticsReport, IStudentStatisticsReport) 9 9 from waeup.kofa.students.tests.test_catalog import CatalogTestSetup 10 10 from waeup.kofa.students.tests.test_browser import StudentsFullSetup … … 12 12 from waeup.kofa.tests.test_async import FunctionalAsyncTestCase 13 13 14 class Student sReportTests(CatalogTestSetup):14 class StudentStatisticsReportTests(CatalogTestSetup): 15 15 16 16 layer = FunctionalLayer … … 23 23 def test_iface(self): 24 24 # ensure we fullfill interface contracts 25 obj = Student sReport(2010, 'Undergraduate Full-Time')26 verifyClass(IStudent sReport, StudentsReport)27 verifyObject(IStudent sReport, obj)25 obj = StudentStatisticsReport(2010, 'Undergraduate Full-Time') 26 verifyClass(IStudentStatisticsReport, StudentStatisticsReport) 27 verifyObject(IStudentStatisticsReport, obj) 28 28 return 29 29 … … 69 69 def test_create_pdf(self): 70 70 self.create_cert('FAC2', 'dept2', 'CERT2') 71 report = Student sReport(2010, 'Undergraduate Full-Time')71 report = StudentStatisticsReport(2010, 'Undergraduate Full-Time') 72 72 result = report.create_pdf() 73 73 self.assertTrue(result.startswith('%PDF-')) 74 74 return 75 75 76 class Student sReportUITests(StudentsFullSetup, FunctionalAsyncTestCase):76 class StudentStatisticsReportUITests(StudentsFullSetup, FunctionalAsyncTestCase): 77 77 78 78 layer = FunctionalLayer … … 116 116 'application/pdf') 117 117 self.assertTrue( 118 'filename="Student sReport_2004_2005_All_' in118 'filename="StudentStatisticsReport_2004_2005_All_' in 119 119 self.browser.headers['content-disposition']) 120 120 self.assertEqual(len(self.app['reports'].running_report_jobs), 1) … … 129 129 logcontent = open(logfile).read() 130 130 self.assertTrue( 131 'INFO - zope.mgr - students.reports. StudentsReportGeneratorPage - '131 'INFO - zope.mgr - students.reports.student_reports.StudentStatisticsReportGeneratorPage - ' 132 132 'report %s created: Students (session=2004, mode=All)' 133 133 % job_id in logcontent 134 134 ) 135 135 self.assertTrue( 136 'INFO - zope.mgr - students.reports. StudentsReportPDFView - '137 'report %s downloaded: Student sReport_2004_2005_All_'136 'INFO - zope.mgr - students.reports.student_reports.StudentStatisticsReportPDFView - ' 137 'report %s downloaded: StudentStatisticsReport_2004_2005_All_' 138 138 % job_id in logcontent 139 139 )
Note: See TracChangeset for help on using the changeset viewer.