## 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 2273 2007-09-25 09:24:06Z joachim $ """ 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['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 = {} try: 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) except AttributeError: continue info['items'] = items return info