- Timestamp:
- 19 Mar 2007, 18:57:54 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/branches/uli/skins/waeup_accommodation/change_bed.py
r1452 r1593 13 13 """ 14 14 import logging 15 logger = logging.getLogger('S tudent.Accommodation.change_bed')15 logger = logging.getLogger('Skins.change_bed') 16 16 17 17 request = context.REQUEST … … 31 31 32 32 if student_id is not None: 33 logger.info(' "%s", "requests bed_change for", "%s"' % (member_id,student_id))33 logger.info('%s requests bed change for %s' % (member_id,student_id)) 34 34 info = context.getAccommodationInfo(student_id) 35 35 res = beds(student=student_id) 36 36 if len(res) == 0: 37 logger.info(' "%s", "no bed found"' % (student_id))38 re direct("%s/%s" % (students.absolute_url(),student_id))37 logger.info('No bed found for %s' % (student_id)) 38 return redirect("%s/%s" % (students.absolute_url(),student_id)) 39 39 allocated_bed = res[0] 40 40 status = info['student_status'] 41 41 student = student_id 42 42 if allocated_bed.bed_type == status: 43 logger.info(' "%s", "correct bed allocated","%s"' % (student_id,status))44 re direct("%s/%s/%s" % (students.absolute_url(),student,info['acco_id']))45 logger.info(' "%s", "change bed", "%s/%s"' % (student_id,allocated_bed.bed_type,status))43 logger.info('Status %s of %s has not changed' % (status,student_id)) 44 return redirect("%s/%s/%s" % (students.absolute_url(),student,info['acco_id'])) 45 logger.info('Bed status %s of %s has changed to %s' % (allocated_bed.bed_type,student_id,status)) 46 46 beds.modifyRecord(bed=allocated_bed.bed,student='') 47 logger.info('Bed %s released' % (allocated_bed.bed)) 47 48 code,bed = beds.searchAndReserveBed(student_id,status) 48 49 if code > 0: … … 56 57 acco_doc = info['acco_doc'] 57 58 acco_doc.edit(mapping=d) 59 logger.info('Bed %s allocated to %s' % (bed,student_id)) 58 60 return redirect("%s/%s/%s" % (students.absolute_url(),student,info['acco_id'])) 59 61 student_obj = getattr(students,student_id) … … 62 64 acco_doc = getattr(student_obj, acco_id).getContent() 63 65 if acco_doc.bed == bed: 64 acco_doc.edit(mapping={'bed':"-- cancelled by %s --" % member})65 logger.info(' "%s", "new bed allocation failed","%s"' % (student_id,code))66 logger.info(' "%s","cancelled booking of bed %s by %s"' % (member,bed,sid))66 acco_doc.edit(mapping={'bed':"-- cancelled by officer due to failed bed change request --"}) 67 logger.info('New bed allocation for %s failed, code = %s' % (student_id,code)) 68 logger.info('%s cancelled booking of bed %s by %s' % (member,bed,student_id)) 67 69 redirect("%s/%s/%s" % (students.absolute_url(),student,info['acco_id'])) 68 70 … … 95 97 d['acco_maint_fee'] = acco_info.get('maintenance_fee') 96 98 acco_doc.edit(mapping=d) 97 list.append(" Student %s new bed %s assigned code = %s" % (student,98 bed,99 list.append("New bed %s allocated to %s, code = %s" % (bed, 100 student, 99 101 code)) 100 102 return "\r".join(list)
Note: See TracChangeset for help on using the changeset viewer.