| 1 | ## Script (Python) "ti_151_resolve" |
|---|
| 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_165_resolve.py 1660 2007-03-29 17:11:02Z joachim $ |
|---|
| 11 | """ |
|---|
| 12 | resolve ticket #151 |
|---|
| 13 | """ |
|---|
| 14 | try: |
|---|
| 15 | from Products.zdb import set_trace |
|---|
| 16 | except: |
|---|
| 17 | def set_trace(): |
|---|
| 18 | pass |
|---|
| 19 | import logging |
|---|
| 20 | #>>>>>>>>>>>>>>>>< |
|---|
| 21 | logger = logging.getLogger('Skins.ti_165_resolve') |
|---|
| 22 | #logger.info('already done on 26.3.07 by joachim') |
|---|
| 23 | #return |
|---|
| 24 | #<<<<<<<<<<<<<<<<< |
|---|
| 25 | request = context.REQUEST |
|---|
| 26 | session = request.SESSION |
|---|
| 27 | response = request.RESPONSE |
|---|
| 28 | setheader = request.RESPONSE.setHeader |
|---|
| 29 | students = context.portal_url.getPortalObject().campus.students |
|---|
| 30 | #from string import Template |
|---|
| 31 | def rwrite(s): |
|---|
| 32 | response.setHeader('Content-type','text/html; charset=ISO-8859-15') |
|---|
| 33 | response.write("%s<br>\n\r" % s) |
|---|
| 34 | def getObject(outer,object): |
|---|
| 35 | if outer.hasObject(object): |
|---|
| 36 | return getattr(outer,object) |
|---|
| 37 | return None |
|---|
| 38 | |
|---|
| 39 | try: |
|---|
| 40 | from Products.AdvancedQuery import Eq, Between, Le,In |
|---|
| 41 | aq_students = context.students_catalog.evalAdvancedQuery |
|---|
| 42 | except: |
|---|
| 43 | evalAdvancedQuery = None |
|---|
| 44 | |
|---|
| 45 | students_cat = context.students_catalog |
|---|
| 46 | pumeresults = context.portal_pumeresults |
|---|
| 47 | de_students = students_cat(entry_mode = 'DE') |
|---|
| 48 | found = 0 |
|---|
| 49 | not_found = 0 |
|---|
| 50 | for des in de_students: |
|---|
| 51 | if not des.jamb_reg_no.startswith('6'): |
|---|
| 52 | continue |
|---|
| 53 | pres = pumeresults(jamb_reg_no = des.jamb_reg_no) |
|---|
| 54 | if not pres: |
|---|
| 55 | rwrite('>>>>>>>> %s with jamb_reg_no %s not found in pumeresults' % (des.id,des.jamb_reg_no)) |
|---|
| 56 | not_found += 1 |
|---|
| 57 | continue |
|---|
| 58 | found += 1 |
|---|
| 59 | rwrite('%s with jamb_reg_no %s found in pumeresults' % (des.id,des.jamb_reg_no)) |
|---|
| 60 | rwrite('%d found in pumeresults <br>%d not found in pumeresults<br>total in portal_pumeresults %d <br>' |
|---|
| 61 | % (found,not_found,len(pumeresults()))) |
|---|
| 62 | |
|---|