Changeset 2102
- Timestamp:
- 16 Aug 2007, 11:45:27 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/skins/waeup_student/apply_pume.py
r2098 r2102 29 29 apply_pume = "apply" in request.keys() 30 30 edit = "edit" in request.keys() 31 submitted = False 31 32 mode = request.get('mode','') 32 33 if not mode: … … 40 41 reg_no = request.get('widget__reg_no','').upper() 41 42 if not reg_no: 42 reg_no = request. get('reg_no','').upper()43 43 reg_no = request.form.get('reg_no','').upper() 44 pin = request.form.get('pin','') 44 45 object = {} 45 #set_trace()46 46 if reg_no: 47 47 brains = context.applicants_catalog(reg_no = reg_no) … … 49 49 for field in context.applicants_catalog.schema(): 50 50 object[field] = getattr(brains[0],field,None) 51 if object['status'] == "submitted": 52 submitted = True 53 #set_trace() 54 if not create and pin != object['pin']: 55 return request.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url()) 51 56 52 57 res,psm,ds = lt.renderLayout(layout_id= 'application', … … 59 64 ) 60 65 66 set_trace() 61 67 if psm == 'invalid': 62 68 return context.apply_pume_form(rendered = res, … … 74 80 elif psm == 'valid': 75 81 pass 76 if create or edit or apply_pume: 77 data = {} 78 for field in context.applicants_catalog.schema(): 79 if ds.has_key(field) and request.has_key("widget__%s" % field): 80 data[field] = ds.get(field) 81 data['reg_no'] = reg_no 82 if apply_pume: 83 data['registration_date'] = current 84 data['status'] = "submitted" 85 context.applicants_catalog.modifyRecord(**data) 86 if apply_pume: 87 if not request.has_key('confirm'): 88 return context.apply_pume_form(rendered = res, 89 psm = "Please confirm Passport Photograph", 90 #psm = "%s, %s" % (psm,ds), 91 mode = mode, 92 ds = ds, 93 ) 94 95 return request.RESPONSE.redirect("%s/apply_pume?mode=view®_no=%s" % 96 (context.absolute_url(),ds.get('reg_no'))) 97 elif edit or create: 98 return request.RESPONSE.redirect("%s/apply_pume?mode=edit®_no=%s" % 99 (context.absolute_url(),ds.get('reg_no'))) 82 data = {} 83 for field in context.applicants_catalog.schema(): 84 if ds.has_key(field) and request.has_key("widget__%s" % field): 85 data[field] = ds.get(field) 86 data['reg_no'] = reg_no 87 if apply_pume: 88 data['registration_date'] = current 89 data['status'] = "submitted" 90 context.applicants_catalog.modifyRecord(**data) 91 if apply_pume: 92 if not request.has_key('confirm'): 93 mode = "edit" 94 psm = "Please confirm Passport Photograph" 95 else: 96 mode = "view" 97 psm = "You successfully applied for PUME" 98 elif create: 99 if submitted: 100 mode = "view" 101 else: 102 mode = "edit" 103 psm = "" 104 #set_trace() 105 object['pin'] = str(ds.get('pin')) 106 res,psm,dummy = lt.renderLayout(layout_id= 'application', 107 schema_id= 'application', 108 layout_mode = mode, 109 context=context, 110 mapping={}, 111 ob=object, 112 commit = False, 113 ) 114 elif edit: 115 mode = "edit" 116 psm = "Content changed" 117 118 return context.apply_pume_form(rendered = res, 119 psm = psm, 120 #psm = "%s, %s" % (psm,ds), 121 mode = mode, 122 ds = ds, 123 ) 100 124 101 125
Note: See TracChangeset for help on using the changeset viewer.