Ignore:
Timestamp:
23 Sep 2020, 19:46:26 (4 years ago)
Author:
Henrik Bettermann
Message:

Don't ask for session object if year is not set.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/applicants/utils.py

    r16226 r16245  
    2121import grok
    2222from time import time
     23from datetime import datetime
    2324from kofacustom.nigeria.applicants.utils import NigeriaApplicantsUtils
    2425from waeup.kofa.applicants.workflow import (INITIALIZED,
     
    109110        """
    110111        timestamp = ("%d" % int(time()*10000))[1:]
    111         session = str(container.year)
    112         try:
    113             session_config = grok.getSite()['configuration'][session]
    114         except KeyError:
    115             return _(u'Session configuration object is not available.')
     112        if container.year:
     113            session = str(container.year)
     114            try:
     115                session_config = grok.getSite()['configuration'][session]
     116            except KeyError:
     117                return _(u'Session configuration object is not available.')
    116118        payment.p_id = "p%s" % timestamp
    117119        payment.p_item = container.title
    118         payment.p_session = container.year
     120        if container.year:
     121            payment.p_session = container.year
     122        else:
     123            payment.p_session = datetime.now().year
    119124        payment.amount_auth = 0.0
    120125        if applicant.special:
Note: See TracChangeset for help on using the changeset viewer.