1 | ## Script (Python) "ti_339_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_339_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 | course = "BARTMAS" |
---|
44 | edited = 0 |
---|
45 | for brain in brains: |
---|
46 | if brain.course1 == course: |
---|
47 | data = {} |
---|
48 | data['reg_no'] = brain.reg_no |
---|
49 | data['screening_date'] = DateTime.DateTime('2007/09/21') |
---|
50 | applicants.modifyRecord(**data) |
---|
51 | edited += 1 |
---|
52 | rwrite('%d: %s,%s,%s,%s' % (edited, |
---|
53 | brain.reg_no, |
---|
54 | brain.course1, |
---|
55 | brain.status, |
---|
56 | brain.email) |
---|
57 | ) |
---|
58 | logger.info("edited %d %s students" % (edited,course)) |
---|