Changeset 3023 for WAeUP_SRP/base


Ignore:
Timestamp:
15 Jan 2008, 07:13:31 (17 years ago)
Author:
Henrik Bettermann
Message:

always show member id

File:
1 edited

Legend:

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

    r3022 r3023  
    5555                      "StudentStudyLevel",)
    5656
    57 #student_objects = student_subobjects + ("Student",)
    5857student_objects = ("Student",)
    5958
     
    201200                             students = [],
    202201                             allowed = allowed,
     202                             info = user_info,
    203203                             )
    204204    elif what == "department":
    205205        query = Eq('department', term.strip())
    206206        logger.info('%s searches for student in department %s' % (member,term))
    207         # res = context.students_catalog(department=term.strip())
    208         # logger.info('%s searches for student in department %s' % (member,term))
    209         # search_set = [r.id for r in res]
    210207    elif what == "matric_no":
    211208        query = Eq('matric_no', term.strip())
    212209        logger.info('%s searches for student with matric_no %s' % (member,term))
    213         # res = context.students_catalog(matric_no=term.strip())
    214         # logger.info('%s searches for student with matric_no %s' % (member,term))
    215         # search_set = [r.id for r in res]
    216210    elif what == "jamb_reg_no":
    217211        st_l = "%s" % term.strip().lower()
     
    219213        query = In('jamb_reg_no',(st_l,st_u))
    220214        logger.info('%s searches for student with jamb_reg_no %s' % (member,term))
    221         # res = aq_students(In('jamb_reg_no',(st_l,st_u)))
    222         # logger.info('%s searches for student with jamb_reg_no %s' % (member,term))
    223         # search_set = [r.id for r in res]
    224215    elif what == "name":
    225216        if len(term) < 4:
    226217            return context.search_students_form(rendered = rend,
    227                                                 psm = "Name too short!",
     218                                                psm = "Search string is too short!",
    228219                                                students = [],
     220                                                info = user_info,
    229221                                                allowed = allowed,
    230222                                               )
    231         # pt = ('StudentPersonal')
    232         # query = In('portal_type',pt) & Eq('SearchableText',"%s*" % term.strip())
    233         # logger.info('%s searches for student with name %s' % (member,term))
    234         # res = aq_portal(query)
    235         # if res:
    236         #     for r in res:
    237         #         pl = r.getPath().split('/')
    238         #         search_set.append(pl[pl.index('students') + 1])
    239223        query = Eq('name',"%s*" % term.strip())
    240224        logger.info('%s searches for student with name %s' % (member,term))
    241         # res = aq_students(query)
    242         # if res:
    243         #     for r in res:
    244         #         search_set += r.id,
    245225
    246226if only_review or with_review or co_view:
    247     #query = Eq('review_state',state)
    248     #review_res = aq_portal(query)
    249     #review_res = context.portal_catalog(review_state = state)
    250227    if query is not None:
    251228        query = Eq('review_state',state) & query
    252229    else:
    253230        query = Eq('review_state',state)
    254     #review_res = aq_students(query)
    255231    logger.info('%s searches for students in review_state %s' % (member,state))
    256232
     
    262238    else:
    263239        query = In('faculty',faculties) | In('department',departments)
    264     # res = aq_students(query)
    265     # search_set.extend([r.id for r in res])
    266240elif ca_view:
    267241    only_review = False
     
    271245    if query is not None:
    272246        query = query & In('course',courses) & In('level',levels)
    273     # res = aq_students(query)
    274     # search_set.extend([r.id for r in res])
    275 
    276 # if review_res:
    277     # review_set = [r.id for r in review_res]
    278 
    279 # if only_review:
    280     # all = review_set
    281 # elif with_review:
    282     # all = []
    283     # for i in search_set:
    284     #     if i in review_set:
    285     #         all.append(i)
    286 # else:
    287     # all = search_set
    288    
    289 # res = aq_students(query)
    290 # all = [r.id for r in res]
    291 
    292 # items = all[:500]
    293 # students = []
    294 # if items:
    295 #     for item in items:
    296 #         students_catalog = context.students_catalog
    297 #         record = students_catalog(id = item)
    298 #         if record:
    299 #             record = record[0]
    300 #         else:
    301 #             return item+' not found in students_catalog'
    302 #         info = {}
    303 #         for field in students_catalog.schema() + students_catalog.indexes():
    304 #             info[field] = getattr(record, field)
    305 #         else:
    306 #             students.append(info)
    307 #     return context.search_students_form(rendered = rend,
    308 #                              psm = "",
    309 #                              info = user_info,
    310 #                              students = students,
    311 #                              allowed = allowed,
    312 #                              co_view = co_view,
    313 #                              ca_view = ca_view
    314 #                              )
    315247student_records = aq_students(query)
    316248students = []
Note: See TracChangeset for help on using the changeset viewer.