[2339] | 1 | ## Script (Python) "ti_361_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_361_resolve.py 2179 2007-09-05 14:03:29Z henrik $ |
---|
| 11 | """ |
---|
| 12 | """ |
---|
| 13 | try: |
---|
| 14 | from Products.zdb import set_trace |
---|
| 15 | except: |
---|
| 16 | def set_trace(): |
---|
| 17 | pass |
---|
| 18 | |
---|
| 19 | mtool = context.portal_membership |
---|
| 20 | member = mtool.getAuthenticatedMember() |
---|
| 21 | if str(member) not in ('admin','joachim'): |
---|
| 22 | return |
---|
| 23 | |
---|
| 24 | |
---|
| 25 | import logging |
---|
| 26 | import DateTime |
---|
| 27 | logger = logging.getLogger('Skins.ti_339_resolve') |
---|
| 28 | from Products.AdvancedQuery import Eq, Between, Le,In |
---|
| 29 | applicants = context.applicants_catalog |
---|
| 30 | |
---|
| 31 | request = context.REQUEST |
---|
| 32 | session = request.SESSION |
---|
| 33 | response = request.RESPONSE |
---|
| 34 | setheader = request.RESPONSE.setHeader |
---|
| 35 | def rwrite(s): |
---|
| 36 | response.setHeader('Content-type','text/html; charset=ISO-8859-15') |
---|
| 37 | response.write("%s<br>\n\r" % s) |
---|
| 38 | |
---|
| 39 | #logger.info('') |
---|
| 40 | |
---|
| 41 | brains = applicants() |
---|
| 42 | total = len(brains) |
---|
| 43 | edited = 0 |
---|
| 44 | for brain in brains: |
---|
| 45 | if brain.screening_type == 'PUME': |
---|
| 46 | data = {} |
---|
| 47 | data['reg_no'] = brain.reg_no |
---|
| 48 | data['screening_type'] = 'pume' |
---|
| 49 | applicants.modifyRecord(**data) |
---|
| 50 | edited += 1 |
---|
| 51 | #rwrite('%d: %s,%s,%s' % (edited, |
---|
| 52 | # brain.reg_no, |
---|
| 53 | # brain.status, |
---|
| 54 | # brain.email) |
---|
| 55 | # ) |
---|
| 56 | logger.info("edited %d students" % (edited)) |
---|