## Script (Python) "getCertificatesInfo" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=student=None ##title= ## # $Id: getCertificatesInfo.py 845 2006-11-11 21:29:50Z henrik $ """ return Info about the Faculties """ request = context.REQUEST wf = context.portal_workflow path_info = request.get('PATH_INFO').split('/') mtool = context.portal_membership info = {} #dep_id = request.get('PATH_TRANSLATED').split('/')[-2] dep_id = context.aq_parent.getId() info['is_manager'] = context.isManager() info['is_student'] = context.isStudent() info['action'] = "%s" % context.absolute_url() info['choosen_ids'] = request.get('ids',[]) info['doc'] = context.getContent() res = context.portal_catalog(meta_type="Department",id = dep_id) info['courses'] = [] if not res: return info brain = res[-1] cp = brain.getPath() info['container_path'] = cp info['dep_id'] = dep_id res = context.portal_catalog(container_path="%s/certificates" % cp) items = [] for r in res: row = {} ro = r.getObject() rd = ro.getContent() row['id'] = r.getId row['title'] = rd.Title() row['url'] = ro.absolute_url() row['review_state'] = wf.getInfoFor(ro,'review_state','None') row['is_editable'] = mtool.checkPermission('Modify portal content', ro) items.append(row) info['items'] = items return info