source: WAeUP_SRP/branches/srpp_branch/skins/waeup_faculty/get_departments_voc.py @ 17718

Last change on this file since 17718 was 182, checked in by joachim, 19 years ago

=eligibility edit geht fast

  • Property svn:keywords set to Id
File size: 702 bytes
Line 
1##parameters=key=None
2# $Id: get_departments_voc.py 182 2005-11-16 23:30:12Z joachim $
3"""
4Return the faculties as an vocabulary
5
6"""
7#academics = context.sections.portal.academics
8academics = context.portal_catalog(id = 'academics')[0].getObject()
9faculties = [f for f in context.filterContents(items=academics.contentValues()) if f.portal_type == 'Faculty']
10
11deplist = []
12for faculty in faculties:
13    departments = [d for d in context.filterContents(items=faculty.contentValues()) if d.portal_type == 'Department']
14    deplist.extend(departments)
15if not key:
16    return [(d.getId(),d.title_or_id(),) for d in deplist]
17return [d.title_or_id() for d in deplist if d.getId() == key][0]
18return [(d.getId(),d.title_or_id()) for d in deplist if d.getId() == key]
Note: See TracBrowser for help on using the repository browser.