## Script (Python) "enable_pins" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=REQUEST,ids=[] ##title= ## # $Id: enable_pins.py 1568 2007-03-17 08:37:51Z henrik $ """ enable pins """ import DateTime current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S") import logging logger = logging.getLogger('Skins.enable_pins') request = REQUEST wftool = context.portal_workflow mtool = context.portal_membership member = mtool.getAuthenticatedMember() #from Products.zdb import set_trace #set_trace() if not ids: return pincat = context.portal_pins for pid in ids: serial,prefix = pid.split("_") res = pincat(prefix_batch=prefix, serial=int(serial)) if len(res) != 1: continue rec = res[0] uid = rec.pin if not rec.student.startswith('disabled'): continue dict = {"pin": uid, "student": "" } pincat.modifyRecord(**dict) logger.info('%s enabled pin %s' % (member,pid)) return request.RESPONSE.redirect("%s/campus/pins/search_pins" % context.portal_url())