Rev | Line | |
---|
[1253] | 1 | ## Script (Python) "search_pins" |
---|
| 2 | ##bind container=container |
---|
| 3 | ##bind context=context |
---|
| 4 | ##bind namespace= |
---|
| 5 | ##bind script=script |
---|
| 6 | ##bind subpath=traverse_subpath |
---|
| 7 | ##parameters=REQUEST |
---|
| 8 | ##title= |
---|
| 9 | ## |
---|
| 10 | # $Id: removeResults.py 1216 2007-01-06 17:40:50Z joachim $ |
---|
| 11 | """ |
---|
| 12 | list Students for ClearanceOfficers |
---|
| 13 | """ |
---|
| 14 | |
---|
| 15 | request = REQUEST |
---|
[1388] | 16 | response = request.RESPONSE |
---|
| 17 | |
---|
| 18 | def rwrite(s): |
---|
| 19 | response.setHeader('Content-type','text/html; charset=ISO-8859-15') |
---|
| 20 | #response.setHeader('Content-length','%d' % (len(s))) |
---|
| 21 | #response.setStatus('OK') |
---|
| 22 | response.write(s) |
---|
| 23 | |
---|
[1253] | 24 | wftool = context.portal_workflow |
---|
| 25 | mtool = context.portal_membership |
---|
| 26 | member = mtool.getAuthenticatedMember() |
---|
| 27 | roles = member.getRolesInContext(context) |
---|
| 28 | rcat = context.results_import |
---|
[1388] | 29 | scat = context.students_catalog |
---|
[1253] | 30 | #from Products.zdb import set_trace;set_trace() |
---|
| 31 | if str(member) not in ('admin','joachim'): |
---|
[1388] | 32 | return |
---|
| 33 | rwrite("start <br />") |
---|
[1253] | 34 | for m in rcat.uniqueValuesFor('matric_no'): |
---|
[1388] | 35 | #if m.startswith('ART'): |
---|
| 36 | res_r = rcat(matric_no = m) |
---|
| 37 | res_s = scat(matric_no = m) |
---|
| 38 | if res_s and res_s[0].course == 'BARTTHR' and res_s[0].level =="500": |
---|
[1253] | 39 | to_del = [] |
---|
[1388] | 40 | for r in res_r: |
---|
[1253] | 41 | to_del.append(r.key) |
---|
[1388] | 42 | |
---|
| 43 | #zum Testen auskommentiert |
---|
| 44 | #for uid in to_del: |
---|
| 45 | #rcat.deleteRecord(uid) |
---|
| 46 | |
---|
| 47 | rwrite(m+" "+res_s[0].course+" "+res_s[0].level + " " + str(len(to_del)) +"<br />") |
---|
| 48 | rwrite("<br />\n Done" ) |
---|
Note: See
TracBrowser for help on using the repository browser.