Changeset 3919 for waeup/branches
- Timestamp:
- 6 Feb 2009, 23:56:52 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-rewrite/src/waeup/university/facultycontainer.py
r3914 r3919 12 12 grok.implements(IFacultyContainer) 13 13 grok.require('waeup.manageUniversity') 14 15 # A simple counter for ids. 16 next_id = 0L 14 17 15 18 def getId(self, faculty): 16 19 """We need a unified id for each faculty, which acts as key. 17 20 """ 18 id = faculty.name 19 id = id.replace(' ', '') 20 return id.lower() 21 return self.next_id 21 22 22 23 def addFaculty(self, faculty): 23 24 if not IFaculty.providedBy(faculty): 24 25 raise TypeError('FacultyContainers contain only IFaculty instances') 25 id = self.getId(faculty)26 self [id] = faculty26 self[self.next_id] = faculty 27 self.next_id += 1 27 28 28 29 # We register FacultyContainer as a utility. This way we can
Note: See TracChangeset for help on using the changeset viewer.