## Script (Python) "apply_pume" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=REQUEST ##title= ## # $Id: apply_pume_manage.py 2156 2007-08-23 17:40:45Z joachim $ """ search for Pume Applications """ try: from Products.zdb import set_trace except: def set_trace(): pass import DateTime import logging logger = logging.getLogger('Skins.apply_pume_manage') mtool = context.portal_membership member = mtool.getAuthenticatedMember() current = DateTime.DateTime() pr = context.portal_registration request = REQUEST if not context.isStaff(): return request.RESPONSE.redirect("%s/srp_anonymous_view" % context.absolete_url()) #type_name = 'StudentApplication' #ti = context.portal_types[type_name] #REQUEST.set('type_name',type_name) reset = "reset" in request.keys() lt = context.portal_layouts reg_no = request.form.get('reg_no','') if same_type(reg_no, []): if reset: reg_no = reg_no[0] elif reg_no[1]: reg_no = reg_no[1] res = '' psm = '' object = {} data = {} if reset and reg_no: data['reg_no'] = reg_no psm = "You successfully reset!" data['status'] = "edited" context.applicants_catalog.modifyRecord(**data) logger.info('%s reset application record of %s' % (member,reg_no)) if reg_no: brains = context.applicants_catalog(reg_no = reg_no) if len(brains) == 1: for field in context.applicants_catalog.schema(): object[field] = getattr(brains[0],field,None) res,psm,ds = lt.renderLayout(layout_id= 'application', schema_id= 'application', layout_mode = "view", context=context, ob=object, commit = False, ) else: psm = "reg no %s not found" % reg_no return context.apply_pume_manage_form(rendered = res, psm = psm, reg_no = reg_no, )