## Script (Python) "getMemberInfo" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters= ##title= ## # $Id: getApplicationInfo.py 1161 2006-12-31 07:50:50Z henrik $ """ return Info about the current Student """ import logging logger = logging.getLogger('Student.Member.Info') request = context.REQUEST mtool = context.portal_membership wf = context.portal_workflow member = mtool.getAuthenticatedMember() member_id = str(member) path_info = request.get('PATH_INFO').split('/') if mtool.isAnonymousUser(): return None info = {} requested_id = context.getStudentId() if requested_id and not context.isStaff() and member_id != requested_id: logger.info('%s tried to access personal object of %s' % (member_id,requested_id)) student_id = requested_id return None elif context.isStaff(): student_id = requested_id else: student_id = member_id students_object = context.portal_url.getPortalObject().campus.students student = getattr(students_object, student_id) if hasattr(student,"application"): info['student'] = student info['id'] = student_id info['review_state'] = context.getStudentReviewState() info['per'] = student.personal info['app'] = student.application info['per_doc'] = student.personal.getContent() info['app_doc'] = student.application.getContent() info['clear_doc'] = student.clearance.getContent() info['password'] = context.waeup_tool.getCredential(student_id) # if info['per_doc'].email: # info['email'] = info['per_doc'].email # else: # info['email'] = info['app_doc'].app_email if info['app_doc'].app_email: info['email'] = info['app_doc'].app_email else: info['email'] = info['per_doc'].email msg=""" Your SRP Member Details ----------------------- Fullname: %s Student Id: %s Matriculation Number: %s Registration Number: %s Registration Status: %s Email Address in Application Data: %s Email Address in Personal Data: %s Date of Birth: %s Password: '%s' """ info['message'] = msg % ( student.Title(), student_id, info['clear_doc'].matric_no, info['app_doc'].jamb_reg_no, info['review_state'], info['app_doc'].app_email, info['per_doc'].email, info['clear_doc'].birthday, info['password'] ) else: info['student'] = student info['id'] = student_id info['review_state'] = wf.getInfoFor(student,'review_state',None) info['password'] = context.waeup_tool.getCredential(student_id) info['email'] = 'N/A' msg=""" Your SRP Member Details ----------------------- Fullname: %s Student Id: %s Password: %s """ info['message'] = msg % ( 'N/A', student_id, info['password'] ) return info