Changeset 4248 for waeup/branches/ulif-rewrite
- Timestamp:
- 11 Jun 2009, 00:22:50 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-rewrite/src/waeup/university/faculty.py
r4230 r4248 9 9 grok.implements(IFaculty) 10 10 11 # A simple counter for ids.12 next_id = 0L13 14 11 def __init__(self, 15 12 title=u'Unnamed Faculty', … … 24 21 if not IDepartment.providedBy(department): 25 22 raise TypeError('Facultues contain only IDepartment instances') 26 id = str(self.next_id) 27 self[id] = department 28 while str(self.next_id) in self.keys(): 29 # Look for next unused int... 30 self.next_id += 1 31 return id 23 self[department.code] = department 32 24 33 25 def clear(self): … … 35 27 for key in keys: 36 28 del self[key] 37 next_id = 0L38 29 39 30
Note: See TracChangeset for help on using the changeset viewer.