Index: waeup/branches/ulif-rewrite/src/waeup/catalog.py
===================================================================
--- waeup/branches/ulif-rewrite/src/waeup/catalog.py	(revision 4471)
+++ waeup/branches/ulif-rewrite/src/waeup/catalog.py	(revision 4472)
@@ -5,5 +5,11 @@
 from hurry.query import Eq
 from waeup.app import University
+from waeup.interfaces import ICourse
 from waeup.student.interfaces import IStudent
+from zope.app.catalog.interfaces import ICatalog
+from zope.app.intid.interfaces import IIntIds
+from zope.component import getUtility
+from zope.component.interfaces import ComponentLookupError
+
 
 class StudentIndexes(grok.Indexes):
@@ -30,2 +36,33 @@
         return result
     
+class CourseIndexes(grok.Indexes):
+     grok.site(University)
+     grok.name('courses_catalog')
+     grok.context(ICourse)
+
+     code = index.Field(attribute='code')
+     title = index.Field(attribute='title')
+
+
+@grok.subscribe(ICourse, grok.IObjectAddedEvent)
+def handleCourseAdd(obj, event):
+     """Index an added course with the local catalog.
+
+     Courses are not indexed automatically, as they are not a
+     dictionary subitem of the accompanied site object
+     (`IUniversity`). I.e. one cannot get them by asking for
+     ``app['FACCODE']['DEPTCODE']['COURSECODE']`` but one has to ask for
+     ``app.faculties['FACCODE']['DEPTCODE'].courses['COURSECODE']``.
+
+     Once, a course is indexed we can leave the further handling to
+     the default component architechture. At least removals will
+     be handled correctly then (and the course unindexed).
+     """
+     try:
+          cat = getUtility(ICatalog, name='courses_catalog')
+     except ComponentLookupError:
+          # catalog not available. This might happen during tests.
+          return
+     intids = getUtility(IIntIds)
+     index = cat['code']
+     index.index_doc(intids.getId(obj), obj)
