Ignore:
Timestamp:
19 Apr 2008, 09:19:02 (17 years ago)
Author:
joachim
Message:

sanitize getClearanceInfo and clearance_edit,
adopt views,
infopenalty? is now set to False.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/skins/waeup_student/getClearanceInfo.py

    r2975 r3452  
    1212return Info about the current Student
    1313"""
     14try:
     15    from Products.zdb import set_trace
     16except:
     17    def set_trace():
     18        pass
    1419import logging
    1520logger = logging.getLogger('Skins.getClearanceInfo')
     
    4247    return None
    4348
     49student_record = context.students_catalog.getRecordByKey(student_id)
    4450students_object = context.portal_url.getPortalObject().campus.students
    4551student = getattr(students_object, student_id)
    46 res = context.portal_catalog(portal_type='Student',id = student_id)
    47 if len(res) == 0:
    48     return None
    49 creation_date = DateTime(res[0].CreationDate)
    50 info['penalty'] = creation_date.lessThan(DateTime('2006/12/5'))
     52# res = context.portal_catalog(portal_type='Student',id = student_id)
     53# if len(res) == 0:
     54#     return None
     55# creation_date = DateTime(res[0].CreationDate)
     56# info['penalty'] = creation_date.lessThan(DateTime('2006/12/5'))
     57info['penalty'] = False
    5158info['id'] = student_id
    5259info['student'] = student
    53 info['review_state'] = context.getStudentReviewState()
    54 info['app'] = student.application
     60info['student_name'] = student_record.name
     61#info['review_state'] = context.getStudentReviewState()
     62info['review_state'] = student_record.review_state
     63# info['app'] = student.application
    5564info['app_doc'] = student.application.getContent()
    5665info['clear'] = student.clearance
     
    5968info['per'] = student.personal
    6069info['per_review_state'] = wf.getInfoFor(student.personal,'review_state',None)
    61 if info['review_state'] in ('clearance_requested', 'cleared_and_validated',):
    62     info['penalty'] = info['penalty'] and\
    63                       info['clear_doc'].entry_date.greaterThan(DateTime('2006/12/30'))
    64 course = getattr(student,'study_course',None)
    65 if course:
    66     cert_id = course.getContent().study_course
    67     res = context.portal_catalog(portal_type = "Certificate", id = cert_id)
    68     ci = {}
    69     if len(res) > 0:
    70         info['course'] = course
    71         brain = res[0]
    72         ci['study_course'] = brain.getId
    73         ci['title'] = brain.Title
    74         pl = brain.getPath().split('/')
    75         ci['faculty'] = pl[-4]
    76         ci['department'] = pl[-3]
    77         info['course_doc'] = ci
    78     else:
    79         info['course'] = None
     70ci = {}
     71ci['course'] = student_record.course
     72ci['faculty'] = student_record.faculty
     73ci['department'] = student_record.department
     74info['course_doc'] = ci
     75# if info['review_state'] in ('clearance_requested', 'cleared_and_validated',):
     76#     info['penalty'] = info['penalty'] and\
     77#                       info['clear_doc'].entry_date.greaterThan(DateTime('2006/12/30'))
     78# course = getattr(student,'study_course',None)
     79# if course:
     80#     cert_id = course.getContent().study_course
     81#     res = context.portal_catalog(portal_type = "Certificate", id = cert_id)
     82#     ci = {}
     83#     if len(res) > 0:
     84#         info['course'] = course
     85#         brain = res[0]
     86#         ci['study_course'] = brain.getId
     87#         ci['title'] = brain.Title
     88#         pl = brain.getPath().split('/')
     89#         ci['faculty'] = pl[-4]
     90#         ci['department'] = pl[-3]
     91#         info['course_doc'] = ci
     92#     else:
     93#         info['course'] = None
    8094return info
Note: See TracChangeset for help on using the changeset viewer.