Changeset 4484 for waeup/branches
- Timestamp:
- 29 Jul 2009, 12:25:12 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-rewrite/src/waeup/university/certificate.py
r4483 r4484 3 3 import grok 4 4 from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState 5 from zope.app.catalog.interfaces import ICatalog 6 from zope.component import getUtility 5 7 from zope.component.interfaces import IFactory 6 8 from zope.interface import implementedBy … … 52 54 """Delete a course denoted by its code. 53 55 """ 54 if code in self.keys(): 55 del self[code] 56 for key in self.keys(): 57 if self[key].getCourseCode != code: 58 continue 59 del self[key] 56 60 self._p_changed = True 57 61 return … … 104 108 certificatecontainer are removed. 105 109 """ 106 old_parent = event.oldParent107 110 code = course.code 108 # Try to find a nearby certificate container...109 dept = getattr(old_parent, '__parent__', None)110 if not IDepartment.providedBy(dept):111 # Hm, looks like this course was not part of a department...112 return113 certcontainer = dept.certificates114 for cert in certcontainer.values():115 # Loop through all certificatecourses in this certificate...116 if code in cert.keys():117 del cert[code]118 cert._p_changed = True119 111 112 # Find all certcourses that reference the given course... 113 cat = getUtility(ICatalog, name='certcourses_catalog') 114 results = cat.searchResults(course_code=(code, code)) 115 for certcourse in results: 116 # Remove that reference... 117 cert = certcourse.__parent__ 118 cert.delCourseRef(code) 119 cert._p_changed = True 120 return
Note: See TracChangeset for help on using the changeset viewer.