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

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

merged up to 1664

  • Property svn:keywords set to Id
File size: 988 bytes
Line 
1## Script (Python) "getCertificateInfo"
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: getCertificateInfo.py 1669 2007-04-04 06:31:52Z joachim $
11"""
12return Info about a Certificate
13"""
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
23request = context.REQUEST
24
25wf = context.portal_workflow
26path_info = request.get('PATH_INFO').split('/')
27
28info = {}
29info['action'] = "%s" % context.absolute_url()
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()
38    if hasattr(ld,'Title'):
39        row['title'] = ld.Title()
40    else:
41        row['title'] = getattr(ld,'title','no title')
42    row['url'] = l.absolute_url()
43    items.append(row)
44items.sort(cmp_id)
45info['items'] = items
46return info
Note: See TracBrowser for help on using the repository browser.