Last change
on this file since 1779 was
1582,
checked in by Henrik Bettermann, 18 years ago
|
change search form for course advisers
|
-
Property svn:keywords set to
Id
|
File size:
1.1 KB
|
Line | |
---|
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 1582 2007-03-19 10:58:13Z henrik $ |
---|
11 | """ |
---|
12 | enable pins |
---|
13 | """ |
---|
14 | import DateTime |
---|
15 | current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S") |
---|
16 | import logging |
---|
17 | logger = logging.getLogger('Skins.enable_pins') |
---|
18 | |
---|
19 | request = REQUEST |
---|
20 | wftool = context.portal_workflow |
---|
21 | mtool = context.portal_membership |
---|
22 | member = mtool.getAuthenticatedMember() |
---|
23 | #from Products.zdb import set_trace |
---|
24 | #set_trace() |
---|
25 | |
---|
26 | if not ids: |
---|
27 | return |
---|
28 | |
---|
29 | pincat = context.portal_pins |
---|
30 | for pid in ids: |
---|
31 | serial,prefix = pid.split("_") |
---|
32 | res = pincat(prefix_batch=prefix, |
---|
33 | serial=int(serial)) |
---|
34 | if len(res) != 1: |
---|
35 | continue |
---|
36 | rec = res[0] |
---|
37 | uid = rec.pin |
---|
38 | if not rec.student.startswith('disabled'): |
---|
39 | continue |
---|
40 | dict = {"pin": uid, |
---|
41 | "student": "" |
---|
42 | } |
---|
43 | pincat.modifyRecord(**dict) |
---|
44 | logger.info('%s enabled pin %s' % (member,uid)) |
---|
45 | return request.RESPONSE.redirect("%s/campus/pins/search_pins" % context.portal_url()) |
---|
Note: See
TracBrowser for help on using the repository browser.