source: WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_academics/getCertificatesInfo.py @ 3763

Last change on this file since 3763 was 1988, checked in by joachim, 17 years ago

merged r1979:r1987 from trunk

  • Property svn:keywords set to Id
File size: 1.3 KB
Line 
1## Script (Python) "getCertificatesInfo"
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: getCertificatesInfo.py 1988 2007-07-05 11:14:12Z joachim $
11"""
12return Info about the Faculties
13"""
14try:
15    from Products.zdb import set_trace
16except:
17    def set_trace():
18        pass
19request = context.REQUEST
20
21wf = context.portal_workflow
22path_info = request.get('PATH_INFO').split('/')
23mtool = context.portal_membership
24
25info = {}
26dep_id = path_info[-2]
27#set_trace()
28info['action'] = "%s" % context.absolute_url()
29info['choosen_ids'] = request.get('ids',[])
30info['doc'] = context.getContent()
31#res = context.portal_catalog(meta_type="Department",id = dep_id)
32info['courses'] = []
33# if not res:
34#     return info
35# brain = res[-1]
36# cp = brain.getPath()
37cp = '/'.join(path_info[:-2])
38info['container_path'] = cp
39info['dep_id'] = dep_id
40
41res = context.portal_catalog(container_path="%s/certificates" % cp)
42items = []
43for 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)
53info['items'] = items
54return info
Note: See TracBrowser for help on using the repository browser.