Last change
on this file since 15613 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 | """ |
---|
12 | return Info about a Certificate |
---|
13 | """ |
---|
14 | def 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 | |
---|
23 | request = context.REQUEST |
---|
24 | |
---|
25 | wf = context.portal_workflow |
---|
26 | path_info = request.get('PATH_INFO').split('/') |
---|
27 | |
---|
28 | info = {} |
---|
29 | info['action'] = "%s" % context.absolute_url() |
---|
30 | info['choosen_ids'] = request.get('ids',[]) |
---|
31 | info['doc'] = context.getContent() |
---|
32 | items = [] |
---|
33 | levels = context.objectValues() |
---|
34 | for 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) |
---|
44 | items.sort(cmp_id) |
---|
45 | info['items'] = items |
---|
46 | return info |
---|
Note: See
TracBrowser for help on using the repository browser.