Last change
on this file since 811 was
805,
checked in by joachim, 18 years ago
|
propset Id
|
-
Property svn:keywords set to
Id
|
File size:
1.1 KB
|
Line | |
---|
1 | ## Script (Python) "cpsdocument_edit" |
---|
2 | ##bind container=container |
---|
3 | ##bind context=context |
---|
4 | ##bind namespace= |
---|
5 | ##bind script=script |
---|
6 | ##bind subpath=traverse_subpath |
---|
7 | ##parameters=batch=None |
---|
8 | ##title= |
---|
9 | ## |
---|
10 | # $Id: getBatchInfo.py 805 2006-11-09 09:38:29Z joachim $ |
---|
11 | """ |
---|
12 | return Info about the current Batch |
---|
13 | """ |
---|
14 | |
---|
15 | info = {} |
---|
16 | if batch is None: |
---|
17 | if context.portal_type == 'ScratchCardBatch': |
---|
18 | batch = context |
---|
19 | else: |
---|
20 | return None |
---|
21 | bd = batch.getContent() |
---|
22 | info['batch_doc'] = bd |
---|
23 | info['id'] = batch.getId() |
---|
24 | info['title'] = batch.Title or 'empty Title' |
---|
25 | info['unused'],used = batch.getContent().getUnusedPins() |
---|
26 | l = [] |
---|
27 | students_rpath = context.portal_catalog(meta_type = "StudentsFolder")[-1].relative_path |
---|
28 | students_url = "%s/%s" % (context.portal_url(),students_rpath) |
---|
29 | |
---|
30 | for item in used: |
---|
31 | sno = item['student'] |
---|
32 | if len(sno)==10: |
---|
33 | #if bd.prefix == "APP": |
---|
34 | res = context.portal_catalog(SearchableText=sno,portal_type='StudentApplication') |
---|
35 | if len(res) > 0: |
---|
36 | item['student_url'] = "%s/%s" % (context.portal_url(),res[0].relative_path) |
---|
37 | else: |
---|
38 | item['student_url'] = None |
---|
39 | else: |
---|
40 | item['student_url'] = '%s/%s' % (students_url,item['student']) |
---|
41 | info['used'] = used |
---|
42 | return info |
---|
Note: See
TracBrowser for help on using the repository browser.