Changeset 9824 for main/waeup.kofa/trunk/src/waeup/kofa/university
- Timestamp:
- 5 Jan 2013, 13:48:04 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/university
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/university/certificate.py
r9341 r9824 75 75 76 76 def delCertCourse(self, code, level=None): 77 """Delete a certificate course denoted by its code. 77 """Delete certificate courses. 78 79 We might have more than one certificate course for a course. 80 If level is not provided all certificate courses referring 81 to the same course will be deleted. 78 82 """ 79 83 keys = list(self.keys()) # create list copy -
main/waeup.kofa/trunk/src/waeup/kofa/university/course.py
r9227 r9824 75 75 code = course.code 76 76 77 # Find all certificatecourses that refer to given course ...77 # Find all certificatecourses that refer to given course 78 78 try: 79 79 cat = getUtility(ICatalog, name='certcourses_catalog') … … 83 83 84 84 results = cat.searchResults(course_code=(code, code)) 85 # Only one certcourse per certificate is needed 86 reduced_results = [] 85 87 for certcourse in results: 86 # Remove that referrer... 88 cert = certcourse.__parent__ 89 if cert in [i.__parent__ for i in reduced_results]: 90 continue 91 reduced_results.append(certcourse) 92 # Now we can apply delCertCourse 93 for certcourse in reduced_results: 87 94 cert = certcourse.__parent__ 88 95 cert.delCertCourse(code) 89 cert._p_changed = True90 96 return 91 97
Note: See TracChangeset for help on using the changeset viewer.