Changeset 5992


Ignore:
Timestamp:
28 Apr 2011, 01:59:47 (14 years ago)
Author:
uli
Message:

Clear certificate and course containers of departments explicitly when
removing a department.

File:
1 edited

Legend:

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

    r5053 r5992  
    1717from waeup.sirp.interfaces import IUniversity
    1818from waeup.sirp.catalog import QueryResultItem
    19 from waeup.sirp.university.interfaces import ICourse, ICertificateCourse
     19from waeup.sirp.university.interfaces import (
     20     ICourse, ICertificateCourse, IDepartment,
     21     )
    2022
    2123class CourseIndexes(grok.Indexes):
     
    5759     index.index_doc(intids.getId(obj), obj)
    5860
     61@grok.subscribe(IDepartment, grok.IObjectRemovedEvent)
     62def handleDepartmentRemoval(obj, event):
     63     """Clear courses and certificates when a department is killed.
     64     """
     65     obj.courses.clear()
     66     obj.certificates.clear()
     67     return
     68
    5969class CourseQueryResultItem(QueryResultItem):
    6070     def __init__(self, context, view):
Note: See TracChangeset for help on using the changeset viewer.