Changeset 5655 for WAeUP_SRP/trunk
- Timestamp:
- 21 Jan 2011, 15:02:44 (14 years ago)
- Location:
- WAeUP_SRP/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/WAeUPTool.py
r5564 r5655 653 653 ###) 654 654 655 security.declarePublic('loadTransferStudentFoto') ###( 656 def loadTransferStudentFoto(self,student_old,student_new): 657 "return a student passport picture" 658 images_dir_new = getImagesDir(student_new) 659 images_dir_old = getImagesDir(student_old) 660 if not os.path.exists(images_dir_new): 661 os.mkdir(images_dir_new) 662 image_name_new = os.path.join(images_dir_new,"passport_%(student_new)s.jpg" % vars()) 663 image_name_old = os.path.join(images_dir_old,"passport_%(student_old)s" % vars()) 664 #import pdb;pdb.set_trace() 665 for extension in ('.jpg','.JPG'): 666 fullname = "%(image_name_old)s%(extension)s" % vars() 667 if os.path.exists(fullname): 668 copy2(fullname,image_name_new) 669 return "successfully copied passport picture" 670 return "passport picture not found: %s.jpg or .JPG" % image_name_old 671 ###) 655 672 656 673 security.declareProtected(ModifyPortalContent,'createOne') ###( -
WAeUP_SRP/trunk/skins/cps_custom/logged_in.py
r5517 r5655 19 19 pass 20 20 import DateTime 21 import os 21 22 current = DateTime.DateTime() 22 23 import logging … … 36 37 is_anon = mtool.isAnonymousUser() 37 38 member = mtool.getAuthenticatedMember() 39 member_id = str(member) 38 40 39 41 if context.isStaff(): 40 is_unsecure = context.waeup_tool.checkGenericPassword( str(member))42 is_unsecure = context.waeup_tool.checkGenericPassword(member_id) 41 43 if is_unsecure: 42 44 response.expireCookie('__ac', path='/') … … 47 49 if not is_anon: 48 50 if "Student" in member.getRoles(): 49 to_waeup_student_home = True50 51 students = context.portal_url.getPortalObject().campus.students 51 student = getattr(students, str(member))52 student = getattr(students,member_id) 52 53 student_app = getattr(student,'application',None) 53 54 student_per = getattr(student,'personal',None) 55 54 56 55 57 ######################################################### … … 61 63 email=request.get("email") 62 64 phone=request.get("phone_nr") 63 context.waeup_tool.makeStudentData( str(member),65 context.waeup_tool.makeStudentData(member_id, 64 66 email=email, 65 67 phone_nr=phone, 66 68 ) 67 69 #d = {} 68 #d['id'] = str(member)70 #d['id'] = member_id 69 71 #d['email'] = email 70 72 #d['phone'] = phone 71 73 #context.students_catalog.modifyRecord(**d) 72 74 elif student_per is None: 73 context.waeup_tool.makeStudentData(str(member)) 74 75 ######################################################### 76 77 student_app = getattr(student,'application',None) 75 context.waeup_tool.makeStudentData(member_id) 78 76 79 77 ######################################################### … … 101 99 else: 102 100 app_doc = student_app.getContent() 101 102 res = context.students_catalog(id = member_id) 103 matric_no = res[0].matric_no 104 jamb_reg_no = res[0].jamb_reg_no 105 entry_mode = res[0].entry_mode 106 verdict = res[0].verdict 107 level = res[0].level 108 has_level = level 109 has_verdict = verdict and not verdict == 'N/A' 103 110 104 111 ######################################################### … … 124 131 # look for passport pictures of returning students 125 132 126 #if s_review_state == 'returning' and 'passport' not in app_doc.objectIds():127 # use new test128 133 if s_review_state == 'returning' and\ 129 not context.waeup_tool.picturesExist(('passport',), student.getId()):134 not context.waeup_tool.picturesExist(('passport',), member_id): 130 135 folder = 'pictures_returning' 131 res = context.students_catalog(id = str(member))136 #res = context.students_catalog(id = member_id) 132 137 filename = res[0].matric_no.upper() 133 138 msg = context.waeup_tool.loadStudentFoto(student,filename,folder) 134 139 logger.info('%s (%s), %s' % (member,s_review_state,msg)) 135 140 136 137 ######################################################### 141 ######################################################### 142 143 # look for passport pictures of transfer students 144 145 if entry_mode == 'transfer' and\ 146 s_review_state in ('returning','school_fee_paid',) and\ 147 not context.waeup_tool.picturesExist(('passport',), member_id): 148 res_both = context.students_catalog(jamb_reg_no = jamb_reg_no) 149 #set_trace() 150 if len(res_both) == 2: 151 for ts in res_both: 152 if ts.id != member_id: 153 msg = context.waeup_tool.loadTransferStudentFoto(ts.id,member_id) 154 logger.info('%s (%s on transfer), %s' % (member,s_review_state,msg)) 155 156 ######################################################### 138 157 139 158 # look for passport pictures of new students … … 144 163 'clearance_requested' 145 164 ) and not context.waeup_tool.picturesExist(('passport',), 146 student.getId()):165 member_id): 147 166 folder = 'pictures_admitted_latest' 148 167 filename = app_doc.jamb_reg_no.replace('/','_') … … 220 239 wftool.doActionFor(student_per,'open') 221 240 222 #########################################################223 224 res = context.students_catalog(id = str(member))225 matric_no = res[0].matric_no226 verdict = res[0].verdict227 level = res[0].level228 has_level = level229 has_verdict = verdict and not verdict == 'N/A'230 241 231 242 #########################################################
Note: See TracChangeset for help on using the changeset viewer.