Changeset 6208 for main/waeup.sirp/trunk/src/waeup
- Timestamp:
- 28 May 2011, 07:32:01 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/university/catalog.py
r6207 r6208 11 11 from waeup.sirp.university.interfaces import ( 12 12 ICourse, ICertificateCourse, IDepartment, 13 ICertificate, 13 14 ) 14 15 15 16 class CourseIndexes(grok.Indexes): 17 """This catalog is needed for building sources. 18 """ 16 19 grok.site(IUniversity) 17 20 grok.name('courses_catalog') … … 21 24 title = grok.index.Text(attribute='title') 22 25 23 class CourseCertificatesIndexes(grok.Indexes): 26 class CertificatesIndexes(grok.Indexes): 27 """This catalog is needed for building sources. 28 """ 29 grok.site(IUniversity) 30 grok.name('certifcates_catalog') 31 grok.context(ICertificate) 32 33 code = grok.index.Field(attribute='code') 34 title = grok.index.Field(attribute='application_category') 35 36 class CertificateCoursesIndexes(grok.Indexes): 37 """This catalog is needed for automatic removal of certificate courses 38 and later for selection course tickets in the students section. 39 """ 24 40 grok.site(IUniversity) 25 41 grok.name('certcourses_catalog') … … 47 63 # catalog not available. This might happen during tests. 48 64 return 65 intids = getUtility(IIntIds) 66 index = cat['code'] 67 index.index_doc(intids.getId(obj), obj) 68 69 @grok.subscribe(ICourse, grok.IObjectAddedEvent) 70 def handleCertificateAdd(obj, event): 71 """Index an added certificates with the local catalog. 72 73 See handleCourseAdd. 74 """ 75 try: 76 cat = getUtility(ICatalog, name='certificates_catalog') 77 except ComponentLookupError: 78 # catalog not available. This might happen during tests. 79 return 49 80 intids = getUtility(IIntIds) 50 81 index = cat['code']
Note: See TracChangeset for help on using the changeset viewer.