Changeset 7350


Ignore:
Timestamp:
15 Dec 2011, 11:54:05 (13 years ago)
Author:
uli
Message:

Also put current course in appcat source, even if it is not catalogued
any more.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/vocabularies.py

    r7347 r7350  
    5050    """
    5151    def getValues(self, context):
    52         appcat = context.__parent__.application_category
     52        # appliction category not available when certificate was deleted.
     53        # shouldn't that info be part of applicant info instead?
     54        # when we cannot determine the appcat, we will display all courses.
     55        appcat = getattr(getattr(context, '__parent__', None),
     56                         'application_category', None)
    5357        catalog = getUtility(ICatalog, name='certificates_catalog')
    54         return sorted(list(
    55                 catalog.searchResults(
    56                     code=('', 'z*'),
    57                     application_category=(appcat,appcat))),
    58                     key=lambda value: value.code)
     58        result = catalog.searchResults(
     59            application_category=(appcat,appcat))
     60        curr_course = context.course1
     61        if curr_course is not None and curr_course not in result:
     62            # display also current course even if it is not catalogued
     63            # (any more)
     64            result = [curr_course,] + result
     65        return sorted(result, key=lambda value: value.code)
Note: See TracChangeset for help on using the changeset viewer.