Last change
on this file since 4049 was
3398,
checked in by Henrik Bettermann, 17 years ago
|
show psm
|
-
Property svn:keywords set to
Id
|
File size:
1.2 KB
|
Line | |
---|
1 | ## Script (Python) "disable_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: disable_pins.py 3398 2008-04-01 06:28:21Z henrik $ |
---|
11 | """ |
---|
12 | disable pins |
---|
13 | """ |
---|
14 | import DateTime |
---|
15 | current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S") |
---|
16 | import logging |
---|
17 | logger = logging.getLogger('Skins.disable_pins') |
---|
18 | |
---|
19 | request = REQUEST |
---|
20 | redirect = request.RESPONSE.redirect |
---|
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 | uid = res[0].pin |
---|
38 | student_id = res[0].student |
---|
39 | dict = {"pin": uid, |
---|
40 | "student": "disabled by %s on %s" % (member,current) |
---|
41 | } |
---|
42 | pincat.modifyRecord(**dict) |
---|
43 | logger.info('%s disabled pin %s (%s)' % (member,uid,student_id)) |
---|
44 | return redirect("%s/campus/pins/search_pins?portal_status_message=PIN %s has been successfully disabled!" % (context.portal_url(),uid)) |
---|
Note: See
TracBrowser for help on using the repository browser.