Ignore:
Timestamp:
19 Sep 2011, 09:53:57 (13 years ago)
Author:
Henrik Bettermann
Message:

Add handleCertificateCourseAdd event handlet.

File:
1 edited

Legend:

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

    r6778 r6797  
    4545
    4646    course_code = grok.index.Field(attribute='getCourseCode')
     47    level = grok.index.Field(attribute='level')
    4748
    4849@grok.subscribe(ICourse, grok.IObjectAddedEvent)
     
    7172@grok.subscribe(ICourse, grok.IObjectAddedEvent)
    7273def handleCertificateAdd(obj, event):
    73     """Index an added certificates with the local catalog.
     74    """Index an added certificate with the local catalog.
    7475
    7576    See handleCourseAdd.
     
    8283    intids = getUtility(IIntIds)
    8384    index = cat['code']
     85    index.index_doc(intids.getId(obj), obj)
     86
     87@grok.subscribe(ICertificateCourse, grok.IObjectAddedEvent)
     88def handleCertificateCourseAdd(obj, event):
     89    """Index an added certificatecourse with the local catalog.
     90
     91    See handleCourseAdd.
     92    """
     93    try:
     94      cat = getUtility(ICatalog, name='certcourses_catalog')
     95    except ComponentLookupError:
     96      # catalog not available. This might happen during tests.
     97      return
     98    intids = getUtility(IIntIds)
     99    index = cat['course_code']
    84100    index.index_doc(intids.getId(obj), obj)
    85101
Note: See TracChangeset for help on using the changeset viewer.