Rev | Line | |
---|
[845] | 1 | ## Script (Python) "getCertificatesInfo" |
---|
[687] | 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 | ## |
---|
[805] | 10 | # $Id: getCertificatesInfo.py 1988 2007-07-05 11:14:12Z joachim $ |
---|
[687] | 11 | """ |
---|
| 12 | return Info about the Faculties |
---|
| 13 | """ |
---|
[1988] | 14 | try: |
---|
| 15 | from Products.zdb import set_trace |
---|
| 16 | except: |
---|
| 17 | def set_trace(): |
---|
| 18 | pass |
---|
[687] | 19 | request = context.REQUEST |
---|
| 20 | |
---|
| 21 | wf = context.portal_workflow |
---|
| 22 | path_info = request.get('PATH_INFO').split('/') |
---|
| 23 | mtool = context.portal_membership |
---|
| 24 | |
---|
| 25 | info = {} |
---|
[1988] | 26 | dep_id = path_info[-2] |
---|
| 27 | #set_trace() |
---|
[687] | 28 | info['action'] = "%s" % context.absolute_url() |
---|
| 29 | info['choosen_ids'] = request.get('ids',[]) |
---|
| 30 | info['doc'] = context.getContent() |
---|
[1988] | 31 | #res = context.portal_catalog(meta_type="Department",id = dep_id) |
---|
[687] | 32 | info['courses'] = [] |
---|
[1988] | 33 | # if not res: |
---|
| 34 | # return info |
---|
| 35 | # brain = res[-1] |
---|
| 36 | # cp = brain.getPath() |
---|
| 37 | cp = '/'.join(path_info[:-2]) |
---|
[687] | 38 | info['container_path'] = cp |
---|
| 39 | info['dep_id'] = dep_id |
---|
| 40 | |
---|
| 41 | res = context.portal_catalog(container_path="%s/certificates" % cp) |
---|
| 42 | items = [] |
---|
| 43 | for r in res: |
---|
| 44 | row = {} |
---|
| 45 | ro = r.getObject() |
---|
| 46 | rd = ro.getContent() |
---|
| 47 | row['id'] = r.getId |
---|
| 48 | row['title'] = rd.Title() |
---|
| 49 | row['url'] = ro.absolute_url() |
---|
| 50 | row['review_state'] = wf.getInfoFor(ro,'review_state','None') |
---|
| 51 | row['is_editable'] = mtool.checkPermission('Modify portal content', ro) |
---|
| 52 | items.append(row) |
---|
| 53 | info['items'] = items |
---|
| 54 | return info |
---|
Note: See
TracBrowser for help on using the repository browser.