Last change
on this file since 1230 was
1216,
checked in by joachim, 18 years ago
|
remove ENG from results_import
|
-
Property svn:keywords set to
Id
|
File size:
849 bytes
|
Rev | Line | |
---|
[1216] | 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 |
---|
| 16 | wftool = context.portal_workflow |
---|
| 17 | mtool = context.portal_membership |
---|
| 18 | member = mtool.getAuthenticatedMember() |
---|
| 19 | roles = member.getRolesInContext(context) |
---|
| 20 | rcat = context.results_import |
---|
| 21 | #from Products.zdb import set_trace;set_trace() |
---|
| 22 | if str(member) not in ('admin','joachim'): |
---|
| 23 | return |
---|
| 24 | count = 0 |
---|
| 25 | for m in rcat.uniqueValuesFor('matric_no'): |
---|
| 26 | if m.startswith('ENG'): |
---|
| 27 | res = rcat(matric_no = m) |
---|
| 28 | to_del = [] |
---|
| 29 | for r in res: |
---|
| 30 | to_del.append(r.key) |
---|
| 31 | for uid in to_del: |
---|
| 32 | rcat.deleteRecord(uid) |
---|
| 33 | count += len(to_del) |
---|
| 34 | return "%d deleted" % count |
---|
Note: See
TracBrowser for help on using the repository browser.