Changeset 1134 for WAeUP_SRP/trunk/skins/waeup_pins
- Timestamp:
- 22 Dec 2006, 17:00:18 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/skins/waeup_pins/search_pins.py
r1120 r1134 18 18 member = mtool.getAuthenticatedMember() 19 19 roles = member.getRolesInContext(context) 20 #from Products.zdb import set_trace 21 #set_trace() 20 pincat = context.portal_pins 21 students = context.portal_url.getPortalObject().campus.students 22 def check_hostel_pins(term): 23 items = pincat(prefix_batch = term) 24 not_found = [] 25 #from Products.zdb import set_trace;set_trace() 26 for item in items: 27 if item.student == '': 28 continue 29 student = getattr(students,item.student,None) 30 if student is None: 31 not_found.append(item) 32 elif not "accommodation_2006" in student.objectIds(): 33 not_found.append(item) 34 else: 35 acco = student.accommodation_2006 36 acco_doc = acco.getContent() 37 pin = "".join(str(acco_doc.acco_res_sc_pin).split('-')) 38 if pin != item.pin: 39 not_found.append(item) 40 return not_found 41 22 42 def set_used_pins(items, from_cat=False): 23 43 l = [] … … 99 119 what = ds.get('search_mode') 100 120 term = ds.get('search_string') 101 pincat = context.portal_pins102 121 if term != "": 103 122 if what == 'student' : … … 106 125 items = items_1 + items_2 107 126 elif what == 'pin': 108 items = pincat(pin = term.upper()) 127 if context.portal_type == "ScratchCardBatch" and term == "HOS1": 128 items = check_hostel_pins(term) 129 else: 130 items = pincat(pin = term.upper()) 109 131 elif what == 'serial': 110 132 try: … … 117 139 else: 118 140 items = [] 119 ## students_url = "%s/%s" % (context.portal_url(),'students')120 141 121 142 info['used'] = set_used_pins(items,from_cat=True)
Note: See TracChangeset for help on using the changeset viewer.