Last change
on this file since 2670 was
2273,
checked in by joachim, 17 years ago
|
fix for #1 fceokene
|
-
Property svn:keywords set to
Id
|
File size:
1.2 KB
|
Line | |
---|
1 | ## Script (Python) "getDepartmentsInfo" |
---|
2 | ##bind container=container |
---|
3 | ##bind context=context |
---|
4 | ##bind namespace= |
---|
5 | ##bind script=script |
---|
6 | ##bind subpath=traverse_subpath |
---|
7 | ##parameters=student=None |
---|
8 | ##title= |
---|
9 | ## |
---|
10 | # $Id: getDepartmentsInfo.py 2273 2007-09-25 09:24:06Z joachim $ |
---|
11 | """ |
---|
12 | return Info about the Faculties |
---|
13 | """ |
---|
14 | request = context.REQUEST |
---|
15 | |
---|
16 | wf = context.portal_workflow |
---|
17 | mtool = context.portal_membership |
---|
18 | member = mtool.getAuthenticatedMember() |
---|
19 | path_info = request.get('PATH_INFO').split('/') |
---|
20 | |
---|
21 | info = {} |
---|
22 | member_id = str(member) |
---|
23 | roles = member.getRolesInContext(context) |
---|
24 | info['action'] = "%s" % context.absolute_url() |
---|
25 | info['choosen_ids'] = request.get('ids',[]) |
---|
26 | items = [] |
---|
27 | info['doc'] = context.getContent() |
---|
28 | brain = context.portal_catalog(meta_type="Faculty", id = context.getId())[-1] |
---|
29 | cp = brain.getPath() |
---|
30 | info['container_path'] = cp |
---|
31 | res = context.portal_catalog(container_path=cp) |
---|
32 | for r in res: |
---|
33 | row = {} |
---|
34 | try: |
---|
35 | ro = r.getObject() |
---|
36 | rd = ro.getContent() |
---|
37 | row['id'] = r.getId |
---|
38 | row['title'] = rd.LongTitle() |
---|
39 | row['url'] = ro.absolute_url() |
---|
40 | row['is_editable'] = mtool.checkPermission('Modify portal content', ro) |
---|
41 | items.append(row) |
---|
42 | except AttributeError: |
---|
43 | continue |
---|
44 | |
---|
45 | info['items'] = items |
---|
46 | return info |
---|
Note: See
TracBrowser for help on using the repository browser.