Changeset 4486 for waeup/branches


Ignore:
Timestamp:
30 Jul 2009, 01:23:27 (15 years ago)
Author:
uli
Message:
  • Be gentle when looking up a catalog.
  • Fix nasty error in delCourseRef().
File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-rewrite/src/waeup/university/certificate.py

    r4484 r4486  
    55from zope.app.catalog.interfaces import ICatalog
    66from zope.component import getUtility
    7 from zope.component.interfaces import IFactory
     7from zope.component.interfaces import IFactory, ComponentLookupError
    88from zope.interface import implementedBy
    99from waeup.interfaces import (ICertificate, ICertificateContainer,
     
    5555        """
    5656        for key in self.keys():
    57             if self[key].getCourseCode != code:
     57            if self[key].getCourseCode() != code:
    5858                continue
    5959            del self[key]
     
    111111
    112112    # Find all certcourses that reference the given course...
    113     cat = getUtility(ICatalog, name='certcourses_catalog')
     113    try:
     114        cat = getUtility(ICatalog, name='certcourses_catalog')
     115    except ComponentLookupError:
     116        # catalog not available. This might happen during tests.
     117        return
     118       
    114119    results = cat.searchResults(course_code=(code, code))
    115120    for certcourse in results:
Note: See TracChangeset for help on using the changeset viewer.