Ignore:
Timestamp:
29 May 2011, 09:23:30 (13 years ago)
Author:
Henrik Bettermann
Message:

Course codes must be unique. Check catalog when courses are added. Flash the place where course exists.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/university/certificatecontainer.py

    r6213 r6216  
    44from waeup.sirp.university.interfaces import (
    55    ICertificateContainer, ICertificate)
    6 from zope.component.interfaces import IFactory
     6from zope.component.interfaces import IFactory, ComponentLookupError
    77from zope.catalog.interfaces import ICatalog
    88from zope.component import getUtility
     
    1919            raise TypeError('CertificateContainers contain only '
    2020                            'ICertificate instances')
    21         cat = getUtility(ICatalog, name='certificates_catalog')
     21        try:
     22            cat = getUtility(ICatalog, name='certificates_catalog')
     23        except ComponentLookupError:
     24            # catalog not available. This might happen during tests.
     25            self[certificate.code] = certificate
     26            return 'Certificate added (for tests only).'
    2227        results = list(cat.searchResults(code=(certificate.code,certificate.code)))
    2328        if results:
Note: See TracChangeset for help on using the changeset viewer.