Changeset 4248


Ignore:
Timestamp:
11 Jun 2009, 00:22:50 (16 years ago)
Author:
uli
Message:

Use code as department key (not a generated integer).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-rewrite/src/waeup/university/faculty.py

    r4230 r4248  
    99    grok.implements(IFaculty)
    1010
    11     # A simple counter for ids.
    12     next_id = 0L
    13    
    1411    def __init__(self,
    1512                 title=u'Unnamed Faculty',
     
    2421        if not IDepartment.providedBy(department):
    2522            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
    3224
    3325    def clear(self):
     
    3527        for key in keys:
    3628            del self[key]
    37         next_id = 0L
    3829
    3930       
Note: See TracChangeset for help on using the changeset viewer.