Ignore:
Timestamp:
9 Jun 2009, 08:54:12 (16 years ago)
Author:
uli
Message:

Use code as faculty key in facultycontainers.

Location:
waeup/branches/ulif-rewrite/src/waeup/university
Files:
2 edited

Legend:

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

    r4229 r4230  
    1515                 title=u'Unnamed Faculty',
    1616                 title_prefix=u'faculty',
    17                  code=None, **kw):
     17                 code=u'NA', **kw):
    1818        super(Faculty, self).__init__(**kw)
    1919        self.title = title
  • waeup/branches/ulif-rewrite/src/waeup/university/facultycontainer.py

    r4222 r4230  
    1919    grok.require('waeup.manageUniversity')
    2020
    21     # A simple counter for ids.
    22     next_id = 0L
    23 
    2421    def addFaculty(self, faculty):
    2522        if not IFaculty.providedBy(faculty):
    2623            raise TypeError('FacultyContainers contain only IFaculty instances')
    27         id = str(self.next_id)
    28         self[id] = faculty
    29         while str(self.next_id) in self.keys():
    30             # Look for next unused int...
    31             self.next_id += 1
    32         return id
     24        self[faculty.code] = faculty
     25        return
    3326
    3427    def clear(self):
Note: See TracChangeset for help on using the changeset viewer.