Changeset 3023 for WAeUP_SRP/base/skins
- Timestamp:
- 15 Jan 2008, 07:13:31 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/skins/waeup_student/search_students.py
r3022 r3023 55 55 "StudentStudyLevel",) 56 56 57 #student_objects = student_subobjects + ("Student",)58 57 student_objects = ("Student",) 59 58 … … 201 200 students = [], 202 201 allowed = allowed, 202 info = user_info, 203 203 ) 204 204 elif what == "department": 205 205 query = Eq('department', term.strip()) 206 206 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]210 207 elif what == "matric_no": 211 208 query = Eq('matric_no', term.strip()) 212 209 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]216 210 elif what == "jamb_reg_no": 217 211 st_l = "%s" % term.strip().lower() … … 219 213 query = In('jamb_reg_no',(st_l,st_u)) 220 214 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]224 215 elif what == "name": 225 216 if len(term) < 4: 226 217 return context.search_students_form(rendered = rend, 227 psm = " Nametoo short!",218 psm = "Search string is too short!", 228 219 students = [], 220 info = user_info, 229 221 allowed = allowed, 230 222 ) 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])239 223 query = Eq('name',"%s*" % term.strip()) 240 224 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,245 225 246 226 if 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)250 227 if query is not None: 251 228 query = Eq('review_state',state) & query 252 229 else: 253 230 query = Eq('review_state',state) 254 #review_res = aq_students(query)255 231 logger.info('%s searches for students in review_state %s' % (member,state)) 256 232 … … 262 238 else: 263 239 query = In('faculty',faculties) | In('department',departments) 264 # res = aq_students(query)265 # search_set.extend([r.id for r in res])266 240 elif ca_view: 267 241 only_review = False … … 271 245 if query is not None: 272 246 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_set281 # 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_set288 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_catalog297 # 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_view314 # )315 247 student_records = aq_students(query) 316 248 students = []
Note: See TracChangeset for help on using the changeset viewer.