source: WAeUP_SRP/trunk/skins/waeup_student/apply_pume_manage.py @ 2163

Last change on this file since 2163 was 2161, checked in by Henrik Bettermann, 17 years ago

resubmit and reset status added

  • Property svn:keywords set to Id
File size: 2.2 KB
RevLine 
[2160]1## Script (Python) "apply_pume_manage"
[2156]2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=REQUEST
8##title=
9##
10# $Id: apply_pume_manage.py 2161 2007-08-24 14:23:50Z henrik $
11"""
12search for  Pume Applications
13"""
14
15try:
16    from Products.zdb import set_trace
17except:
18    def set_trace():
19        pass
20
21import DateTime
22import logging
23logger = logging.getLogger('Skins.apply_pume_manage')
24mtool = context.portal_membership
25member = mtool.getAuthenticatedMember()
26
27current = DateTime.DateTime()
28pr = context.portal_registration
29request = REQUEST
30
31
[2158]32if not context.isSectionOfficer():
[2156]33    return request.RESPONSE.redirect("%s/srp_anonymous_view" % context.absolete_url())
[2158]34
[2156]35#type_name = 'StudentApplication'
36#ti = context.portal_types[type_name]
37#REQUEST.set('type_name',type_name)
38reset = "reset" in request.keys()
39lt = context.portal_layouts
[2157]40
[2160]41reg_no = request.get('reg_no','').upper()
42new_reg_no = request.get('new_reg_no','').upper()
[2157]43
44if reset:
45    reg_no = reg_no
46elif new_reg_no:
47    reg_no = new_reg_no
48
[2156]49res = ''
50psm = ''
51object = {}
52data = {}
53if reset and reg_no:
54    data['reg_no'] = reg_no
[2157]55    psm = "You successfully reset the record! The applicant will be able to edit and resubmit the data."
[2161]56    data['status'] = "reset"
[2156]57    context.applicants_catalog.modifyRecord(**data)
58    logger.info('%s reset application record of %s' % (member,reg_no))
[2157]59
[2158]60#set_trace()
61
62ds = []
[2156]63if reg_no:
64    brains = context.applicants_catalog(reg_no = reg_no)
65    if len(brains) == 1:
66        for field in context.applicants_catalog.schema():
67            object[field] = getattr(brains[0],field,None)
[2157]68        res,psm_dummy,ds = lt.renderLayout(layout_id= 'application',
[2156]69                                     schema_id= 'application',
[2157]70                                     layout_mode = "view_slip",
[2156]71                                     context=context,
72                                     ob=object,
73                                     commit = False,
74                                    )
75    else:
76        psm = "reg no %s not found" % reg_no
[2158]77
[2156]78return context.apply_pume_manage_form(rendered = res,
79                                      psm = psm,
80                                      reg_no = reg_no,
[2157]81                                      ds = ds
[2156]82                                     )
83
84
Note: See TracBrowser for help on using the repository browser.