source: waeup_product/trunk/skins/waeup_faculty/get_departments_voc.py @ 175

Last change on this file since 175 was 173, checked in by joachim, 19 years ago

=added Faculties and Departments in install + other cosmetics

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