- Timestamp:
- 25 Oct 2012, 09:44:02 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/hostels/vocabularies.py
r9400 r9414 27 27 28 28 NOT_OCCUPIED = u'not occupied' 29 30 class StudentSource(BasicContextualSourceFactory):31 """A students source delivers all students in accommodation session.32 """33 34 def acco_students(self, context):35 catalog = getUtility(ICatalog, name='students_catalog')36 accommodation_session = getSite()['hostels'].accommodation_session37 students = catalog.searchResults(current_session=(38 accommodation_session,accommodation_session))39 existing_students = [40 context.__parent__[key].owner41 for key in context.__parent__.keys()]42 students = [student for student in students43 if not student.student_id in existing_students]44 students = sorted(list(students),45 key=lambda value: value.student_id)46 return dict([(student.student_id,student.fullname) for student in students])47 48 def getValues(self, context):49 return self.acco_students(context).keys()50 51 def getToken(self, context, value):52 return value53 54 def getTitle(self, context, value):55 return "%s - %s" % (value, self.acco_students(context)[value])56 29 57 30 class SpecialHandlingSource(ContextualDictSourceFactoryBase):
Note: See TracChangeset for help on using the changeset viewer.