Last change
on this file since 1345 was
1002,
checked in by joachim, 18 years ago
|
search for PIN added
|
-
Property svn:keywords set to
Id
|
File size:
1.2 KB
|
Rev | Line | |
---|
[845] | 1 | ## Script (Python) "getBatchInfo" |
---|
[535] | 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 | ## |
---|
[805] | 10 | # $Id: getBatchInfo.py 1002 2006-12-06 18:08:45Z joachim $ |
---|
[535] | 11 | """ |
---|
[688] | 12 | return Info about the current Batch |
---|
[535] | 13 | """ |
---|
| 14 | |
---|
| 15 | info = {} |
---|
| 16 | if batch is None: |
---|
| 17 | if context.portal_type == 'ScratchCardBatch': |
---|
| 18 | batch = context |
---|
| 19 | else: |
---|
| 20 | return None |
---|
[696] | 21 | bd = batch.getContent() |
---|
| 22 | info['batch_doc'] = bd |
---|
[535] | 23 | info['id'] = batch.getId() |
---|
| 24 | info['title'] = batch.Title or 'empty Title' |
---|
[696] | 25 | info['unused'],used = batch.getContent().getUnusedPins() |
---|
| 26 | l = [] |
---|
[1002] | 27 | p_url = context.portal_url |
---|
| 28 | students_url = "%s/%s" % (p_url,"students") |
---|
[696] | 29 | |
---|
| 30 | for item in used: |
---|
[770] | 31 | sno = item['student'] |
---|
[801] | 32 | if len(sno)==10: |
---|
[770] | 33 | #if bd.prefix == "APP": |
---|
[1002] | 34 | #res = context.portal_catalog(SearchableText=sno,portal_type='StudentApplication') |
---|
| 35 | res = context.students_catalog(jamb_reg_no=sno) |
---|
[710] | 36 | if len(res) > 0: |
---|
[1002] | 37 | item['student_url'] = "%s/%s" % (context.portal_url(),res[0].id) |
---|
| 38 | item['student_id'] = res[0].id |
---|
[708] | 39 | else: |
---|
[709] | 40 | item['student_url'] = None |
---|
[696] | 41 | else: |
---|
| 42 | item['student_url'] = '%s/%s' % (students_url,item['student']) |
---|
[1002] | 43 | item['student_id'] = student |
---|
[696] | 44 | info['used'] = used |
---|
[535] | 45 | return info |
---|
Note: See
TracBrowser for help on using the repository browser.