Ignore:
Timestamp:
23 Sep 2020, 19:27:06 (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.kofa/trunk/src/waeup/kofa/applicants/utils.py

    r16134 r16242  
    2020
    2121from time import time
     22from datetime import datetime
    2223import grok
    2324from zope.component import getUtility
     
    6162        """
    6263        timestamp = ("%d" % int(time()*10000))[1:]
    63         session = str(container.year)
    64         try:
    65             session_config = grok.getSite()['configuration'][session]
    66         except KeyError:
    67             return _(u'Session configuration object is not available.')
     64        if container.year:
     65            session = str(container.year)
     66            try:
     67                session_config = grok.getSite()['configuration'][session]
     68            except KeyError:
     69                return _(u'Session configuration object is not available.')
    6870        payment.p_id = "p%s" % timestamp
    6971        payment.p_item = container.title
    70         payment.p_session = container.year
     72        if container.year:
     73            payment.p_session = container.year
     74        else:
     75            payment.p_session = datetime.now().year
    7176        payment.amount_auth = 0.0
    7277        if applicant.special:
Note: See TracChangeset for help on using the changeset viewer.