Last change
on this file since 11110 was
3399,
checked in by Henrik Bettermann, 17 years ago
|
logging message changed
|
-
Property svn:keywords set to
Id
|
File size:
1.2 KB
|
Rev | Line | |
---|
[1062] | 1 | ## Script (Python) "enable_pins" |
---|
| 2 | ##bind container=container |
---|
| 3 | ##bind context=context |
---|
| 4 | ##bind namespace= |
---|
| 5 | ##bind script=script |
---|
| 6 | ##bind subpath=traverse_subpath |
---|
| 7 | ##parameters=REQUEST,ids=[] |
---|
| 8 | ##title= |
---|
| 9 | ## |
---|
| 10 | # $Id: enable_pins.py 3399 2008-04-01 06:32:22Z henrik $ |
---|
| 11 | """ |
---|
| 12 | enable pins |
---|
| 13 | """ |
---|
| 14 | import DateTime |
---|
| 15 | current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S") |
---|
| 16 | import logging |
---|
[1568] | 17 | logger = logging.getLogger('Skins.enable_pins') |
---|
[1062] | 18 | |
---|
| 19 | request = REQUEST |
---|
[3398] | 20 | redirect = request.RESPONSE.redirect |
---|
[1062] | 21 | wftool = context.portal_workflow |
---|
| 22 | mtool = context.portal_membership |
---|
| 23 | member = mtool.getAuthenticatedMember() |
---|
| 24 | #from Products.zdb import set_trace |
---|
| 25 | #set_trace() |
---|
| 26 | |
---|
| 27 | if not ids: |
---|
| 28 | return |
---|
| 29 | |
---|
| 30 | pincat = context.portal_pins |
---|
| 31 | for pid in ids: |
---|
| 32 | serial,prefix = pid.split("_") |
---|
| 33 | res = pincat(prefix_batch=prefix, |
---|
| 34 | serial=int(serial)) |
---|
| 35 | if len(res) != 1: |
---|
| 36 | continue |
---|
| 37 | rec = res[0] |
---|
| 38 | uid = rec.pin |
---|
[3385] | 39 | student_id = rec.student |
---|
| 40 | # if not rec.student.startswith('disabled'): |
---|
| 41 | # continue |
---|
[1062] | 42 | dict = {"pin": uid, |
---|
| 43 | "student": "" |
---|
| 44 | } |
---|
| 45 | pincat.modifyRecord(**dict) |
---|
[3399] | 46 | logger.info('%s enabled pin %s (%s)' % (member,uid,student_id)) |
---|
[3398] | 47 | return redirect("%s/campus/pins/search_pins?portal_status_message=PIN %s has been successfully (re-)enabled!" % (context.portal_url(),uid)) |
---|
Note: See
TracBrowser for help on using the repository browser.