Ignore:
Timestamp:
23 May 2013, 05:39:45 (12 years ago)
Author:
Henrik Bettermann
Message:

Move resultset post-processing to filterCertificates method.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/applicants
Files:
3 edited

Legend:

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

    r10187 r10208  
    9696        result = catalog.searchResults(
    9797            application_category=(appcat,appcat))
    98         result = getUtility(
     98        resultlist = getUtility(
    9999            IApplicantsUtils).filterCertificates(context, result)
    100         curr_course = context.course1
    101         if curr_course is not None and curr_course not in result:
    102             # display also current course even if certificate has been removed
    103             result = [curr_course,] + result
    104         return result
     100        return resultlist
    105101
    106102    def getTitle(self, context, value):
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_interfaces.py

    r7872 r10208  
    2222from zc.sourcefactory.browser.source import FactoredTerms
    2323from zope.publisher.browser import TestRequest
    24 from waeup.kofa.applicants.interfaces import ApplicationTypeSource
    2524from waeup.kofa.students.vocabularies import GenderSource
    2625
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/utils.py

    r10187 r10208  
    8181        """Filter and sort certificates in AppCatCertificateSource.
    8282        """
    83         return sorted(resultset, key=lambda value: value.code)
     83        resultlist = sorted(resultset, key=lambda value: value.code)
     84        curr_course = context.course1
     85        if curr_course is not None and curr_course not in resultlist:
     86            # display also current course even if certificate has been removed
     87            resultlist = [curr_course,] + resultlist
     88        return resultlist
    8489
    8590    def getCertTitle(self, context, value):
Note: See TracChangeset for help on using the changeset viewer.