Changeset 9519


Ignore:
Timestamp:
4 Nov 2012, 06:13:36 (12 years ago)
Author:
Henrik Bettermann
Message:

Session configuration must always exist.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/students
Files:
2 edited

Legend:

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

    r9517 r9519  
    20332033
    20342034    def test_student_schoolfee_payment(self):
     2035        configuration = createObject('waeup.SessionConfiguration')
     2036        configuration.academic_session = 2005
     2037        self.app['configuration'].addSessionConfiguration(configuration)
    20352038        # Login
    20362039        self.browser.open(self.login_path)
     
    22082211
    22092212    def test_postgraduate_student_payments(self):
     2213        configuration = createObject('waeup.SessionConfiguration')
     2214        configuration.academic_session = 2005
     2215        self.app['configuration'].addSessionConfiguration(configuration)
    22102216        self.certificate.study_mode = 'pg_ft'
    22112217        self.certificate.start_level = 999
  • main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py

    r9517 r9519  
    300300        return
    301301
     302    def _getSessionConfiguration(self, session):
     303        try:
     304            return grok.getSite()['configuration'][str(session)]
     305        except KeyError:
     306            return None
     307
    302308    def setPaymentDetails(self, category, student,
    303309            previous_session, previous_level):
     
    326332            p_level = student['studycourse'].current_level
    327333            p_current = True
    328         session = str(p_session)
    329         try:
    330             academic_session = grok.getSite()['configuration'][session]
    331         except KeyError:
     334        academic_session = self._getSessionConfiguration(p_session)
     335        if academic_session == None:
    332336            return _(u'Session configuration object is not available.'), None
    333337        if category == 'schoolfee':
     
    353357                    # has paid for. Payment session is always next session.
    354358                    p_session, p_level = self.getReturningData(student)
     359                    academic_session = self._getSessionConfiguration(p_session)
     360                    if academic_session == None:
     361                        return _(u'Session configuration object is not available.'), None
    355362                    amount = getattr(certificate, 'school_fee_2', 0.0)
    356363                elif student.is_postgrad and student.state == PAID:
     
    358365                    # but their level always remains the same.
    359366                    p_session += 1
     367                    academic_session = self._getSessionConfiguration(p_session)
     368                    if academic_session == None:
     369                        return _(u'Session configuration object is not available.'), None
    360370                    amount = getattr(certificate, 'school_fee_2', 0.0)
    361371        elif category == 'clearance':
Note: See TracChangeset for help on using the changeset viewer.