Ignore:
Timestamp:
24 May 2019, 16:39:08 (5 years ago)
Author:
Henrik Bettermann
Message:

Catch traceback if current academic session is not set.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r15423 r15426  
    36033603    grok.require('waeup.showStudents')
    36043604
     3605    def update(self):
     3606        self.current_academic_session = grok.getSite()[
     3607            'configuration'].current_academic_session
     3608        if not self.current_academic_session:
     3609            self.flash(_('Current academic session not set.'), type="danger")
     3610            self.redirect(self.url(self.context))
     3611            return
     3612
    36053613    @property
    36063614    def note(self):
     
    36343642
    36353643    def render(self):
    3636         session = grok.getSite()['configuration'].current_academic_session
    36373644        lecturers = [i['user_title'] for i in self.getUsersWithLocalRoles()
    36383645                     if i['local_role'] == 'waeup.local.Lecturer']
     
    36403647        students_utils = getUtility(IStudentsUtils)
    36413648        return students_utils.renderPDFCourseticketsOverview(
    3642             self, 'coursetickets', session, self.data(session), lecturers,
     3649            self, 'coursetickets', self.current_academic_session,
     3650            self.data(self.current_academic_session), lecturers,
    36433651            'landscape', 90, self.note)
    36443652
     
    36503658    grok.name('attendance.pdf')
    36513659    grok.require('waeup.showStudents')
     3660
     3661    def update(self):
     3662        self.current_academic_session = grok.getSite()[
     3663            'configuration'].current_academic_session
     3664        if not self.current_academic_session:
     3665            self.flash(_('Current academic session not set.'), type="danger")
     3666            self.redirect(self.url(self.context))
     3667            return
    36523668
    36533669    @property
     
    36823698
    36833699    def render(self):
    3684         session = grok.getSite()['configuration'].current_academic_session
    36853700        lecturers = [i['user_title'] for i in self.getUsersWithLocalRoles()
    36863701                     if i['local_role'] == 'waeup.local.Lecturer']
     
    36883703        students_utils = getUtility(IStudentsUtils)
    36893704        return students_utils.renderPDFCourseticketsOverview(
    3690             self, 'attendance', session, self.data(session),
     3705            self, 'attendance', self.current_academic_session,
     3706            self.data(self.current_academic_session),
    36913707            lecturers, 'landscape', 90, self.note)
    36923708
Note: See TracChangeset for help on using the changeset viewer.