|
Last change
on this file since 3473 was
913,
checked in by Henrik Bettermann, 20 years ago
|
|
is_* keys removed from get* functions
|
-
Property svn:keywords set to
Id
|
|
File size:
1.1 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 913 2006-11-21 10:49:45Z henrik $ |
|---|
| 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 | ro = r.getObject() |
|---|
| 35 | rd = ro.getContent() |
|---|
| 36 | row['id'] = r.getId |
|---|
| 37 | row['title'] = rd.LongTitle() |
|---|
| 38 | row['url'] = ro.absolute_url() |
|---|
| 39 | row['is_editable'] = mtool.checkPermission('Modify portal content', ro) |
|---|
| 40 | items.append(row) |
|---|
| 41 | info['items'] = items |
|---|
| 42 | return info |
|---|
Note: See
TracBrowser for help on using the repository browser.