source: WAeUP_SRP/branches/joachim-event-branch/skins/waeup_academics/getCertificateInfo.py @ 11102

Last change on this file since 11102 was 1669, checked in by joachim, 18 years ago

merged up to 1664

  • Property svn:keywords set to Id
File size: 988 bytes
RevLine 
[845]1## Script (Python) "getCertificateInfo"
[556]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: getCertificateInfo.py 1669 2007-04-04 06:31:52Z joachim $
[556]11"""
12return Info about a Certificate
13"""
[1669]14def cmp_id(a,b):
15    s1 = "%(id)s" % a
16    s2 = "%(id)s" % b
17    if s1 == s2:
18        return 0
19    if s1 > s2:
20        return 1
21    return -1
22
[556]23request = context.REQUEST
24
25wf = context.portal_workflow
26path_info = request.get('PATH_INFO').split('/')
27
28info = {}
[1669]29info['action'] = "%s" % context.absolute_url()
[556]30info['choosen_ids'] = request.get('ids',[])
31info['doc'] = context.getContent()
32items = []
33levels = context.objectValues()
34for l in levels:
35    row = {}
36    ld = l.getContent()
37    row['id'] = l.getId()
[577]38    if hasattr(ld,'Title'):
39        row['title'] = ld.Title()
40    else:
41        row['title'] = getattr(ld,'title','no title')
[556]42    row['url'] = l.absolute_url()
43    items.append(row)
[1669]44items.sort(cmp_id)
[556]45info['items'] = items
46return info
Note: See TracBrowser for help on using the repository browser.