Ignore:
Timestamp:
8 Jul 2020, 20:32:51 (4 years ago)
Author:
Henrik Bettermann
Message:

Define TranscriptCertificateSource?.

File:
1 edited

Legend:

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

    r16151 r16152  
    2323from zope import schema
    2424#from zope.interface import invariant, Invalid
    25 #from zope.component import getUtility
    26 #from zope.catalog.interfaces import ICatalog
     25from zope.component import getUtility
     26from zope.catalog.interfaces import ICatalog
    2727from zc.sourcefactory.basic import BasicSourceFactory
    2828from waeup.kofa.applicants.interfaces import (
     
    5555from waeup.uniben.payments.interfaces import ICustomOnlinePayment
    5656
     57class TranscriptCertificateSource(CertificateSource):
     58    """Include Department and Faculty in Title.
     59    """
     60    def getValues(self, context):
     61        catalog = getUtility(ICatalog, name='certificates_catalog')
     62        resultset = catalog.searchResults(code=(None, None))
     63        resultlist = sorted(resultset, key=lambda
     64            value: value.__parent__.__parent__.__parent__.code +
     65            value.__parent__.__parent__.code +
     66            value.code)
     67        return resultlist
     68
     69    def getTitle(self, context, value):
     70        """
     71        """
     72        try: title = "%s / %s / %s (%s)" % (
     73            value.__parent__.__parent__.__parent__.title,
     74            value.__parent__.__parent__.title,
     75            value.title, value.code)
     76        except AttributeError:
     77            title = "NA / %s (%s)" % (value.title, value.code)
     78        return title
    5779
    5880REGISTRATION_CATS = {
     
    340362    course_studied = schema.Choice(
    341363        title = _(u'Course of Study'),
    342         source = CertificateSource(),
     364        source = TranscriptCertificateSource(),
     365        description = u'Faculty / Department / Study Course',
    343366        required = False,
    344367        readonly = False,
     
    348371        title = _(u'Change of Study Course / Transfer'),
    349372        description = u'If yes, select previous course of study.',
    350         source = CertificateSource(),
     373        source = TranscriptCertificateSource(),
    351374        readonly = False,
    352375        required = False,
Note: See TracChangeset for help on using the changeset viewer.