[2033] | 1 | ## Script (Python) "findStudentsWithCourses" |
---|
| 2 | ##bind container=container |
---|
| 3 | ##bind context=context |
---|
| 4 | ##bind namespace= |
---|
| 5 | ##bind script=script |
---|
| 6 | ##bind subpath=traverse_subpath |
---|
| 7 | ##parameters= |
---|
| 8 | ##title= |
---|
| 9 | ## |
---|
| 10 | # $Id: ti_311_resolve.py 2033 2007-07-18 13:44:13Z joachim $ |
---|
| 11 | """ |
---|
| 12 | """ |
---|
| 13 | try: |
---|
| 14 | from Products.zdb import set_trace |
---|
| 15 | except: |
---|
| 16 | def set_trace(): |
---|
| 17 | pass |
---|
| 18 | import logging |
---|
| 19 | logger = logging.getLogger('Skins.ti_311_resolve') |
---|
| 20 | from Products.AdvancedQuery import Eq, Between, Le,In |
---|
| 21 | aq_students = context.students_catalog.evalAdvancedQuery |
---|
| 22 | |
---|
| 23 | request = context.REQUEST |
---|
| 24 | session = request.SESSION |
---|
| 25 | response = request.RESPONSE |
---|
| 26 | setheader = request.RESPONSE.setHeader |
---|
| 27 | students = context.portal_url.getPortalObject().campus.students |
---|
| 28 | #from string import Template |
---|
| 29 | def rwrite(s): |
---|
| 30 | response.setHeader('Content-type','text/html; charset=ISO-8859-15') |
---|
| 31 | response.write("%s<br>\n\r" % s) |
---|
| 32 | |
---|
| 33 | #logger.info('') |
---|
| 34 | |
---|
| 35 | query = Eq('review_state','courses_registered') & Eq('session','05') |
---|
| 36 | brains = aq_students(query) |
---|
| 37 | total = len(brains) |
---|
| 38 | logger.info('found %d students with session 05 and courses_registered' % total) |
---|
| 39 | count = 0 |
---|
| 40 | for brain in brains: |
---|
| 41 | rwrite('%s , %s ,%s, %s' % (brain.id,brain.jamb_reg_no,brain.matric_no,brain.name)) |
---|