Changeset 1566
- Timestamp:
- 17 Mar 2007, 07:15:19 (18 years ago)
- Location:
- WAeUP_SRP/trunk/skins/waeup_accommodation
- Files:
-
- 2 added
- 3 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/skins/waeup_accommodation/allocate_reserved_bed.py
r1477 r1566 13 13 acco_cat = context.portal_accommodation 14 14 import logging 15 logger = logging.getLogger(' Accommodation.AllocateReservedBed')15 logger = logging.getLogger('Skins.allocate_reserved_bed') 16 16 17 17 #change = REQUEST.has_key("allocate_and_change") … … 73 73 if allocate or change: 74 74 if already and not change: 75 psm = "Student %s already reserved bed %s" % (sid, already[0].bed)75 psm = "Student %s has already reserved bed %s" % (sid, already[0].bed) 76 76 break 77 77 if not bed_brain.bed_type.endswith("reserved"): 78 psm = " Not a reserved bed: %s" % bid78 psm = "%s is not a reserved bed" % bid 79 79 break 80 80 if bed_brain.student and not change: … … 88 88 acco_doc = getattr(student_obj, acco_id).getContent() 89 89 if acco_doc.bed == bid: 90 psm = "Student %s has already booked ( paid) bed %s" % (sid, bid)90 psm = "Student %s has already booked (and paid) bed %s" % (sid, bid) 91 91 break 92 92 if not already: … … 94 94 break 95 95 if not bed_brain.bed_type.endswith("reserved"): 96 psm = " Not a reserved bed: %s" % bid96 psm = "%s is not a reserved bed" % bid 97 97 break 98 98 if not bed_brain.student: … … 118 118 acco_doc = getattr(student_obj, acco_id).getContent() 119 119 acco_doc.edit(mapping={'bed': bid}) 120 logger.info(' "%s","booked reserved bed %s for","%s"' % (member,bid,sid))120 logger.info('%s booked reserved bed %s for %s' % (member,bid,sid)) 121 121 psm = "Bed %s reserved for %s %s" % (bid,sid,student.name) 122 122 elif release: … … 130 130 if modify: 131 131 acco_cat.modifyRecord(bed=bid,student='') 132 logger.info(' "%s","cancelled reservation %s by","%s"' % (member,bid,sid))132 logger.info('%s released bed %s booked by %s' % (member,bid,sid)) 133 133 psm = "%s removed from %s" % (student.name,bid) 134 134 else: 135 psm = " %s removing failed from %s" % (student.name,bid)135 psm = "Removing of %s from bed %s failed" % (student.name,bid) 136 136 137 137 mode = 'view' -
WAeUP_SRP/trunk/skins/waeup_accommodation/change_bed.py
r1452 r1566 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) -
WAeUP_SRP/trunk/skins/waeup_accommodation/getAccoHallInfo.py
r1445 r1566 59 59 d['student'] = st 60 60 d['student_url'] ='%s/%s' % (students_url,st) 61 bed = context. formatBed(sbrain.bed).split('/')61 bed = context.getFormattedBed(sbrain.bed).split('/') 62 62 d['bed'] = " / ".join(bed[1:]) 63 63 erg = context.students_catalog(id = st) -
WAeUP_SRP/trunk/skins/waeup_accommodation/hall_delete.py
r805 r1566 1 ## Script (Python) " folder_delete"1 ## Script (Python) "hall_delete" 2 2 ##bind container=container 3 3 ##bind context=context … … 12 12 FIXME: add docstring. 13 13 """ 14 15 import logging 16 logger = logging.getLogger('Skins.hall_delete') 17 member_id = str(context.portal_membership.getAuthenticatedMember()) 14 18 15 19 from Products.CMFCore.utils import getToolByName … … 41 45 here.manage_delObjects(ids) 42 46 message = 'portal_status_message=hall(s) %s with %s beds deleted' % (" ".join(halls),len(urls)) 47 logger.info('%s deletes hall(s) %s with %s beds' % (member_id," ".join(halls),len(urls))) 43 48 else: 44 49 message = 'portal_status_message=psm_select_at_least_one_document' -
WAeUP_SRP/trunk/skins/waeup_accommodation/release_bed.py
r1536 r1566 1 ## Script (Python) " change_bed"1 ## Script (Python) "release_bed" 2 2 ##bind container=container 3 3 ##bind context=context … … 13 13 """ 14 14 import logging 15 logger = logging.getLogger('S tudent.Accommodation.release_bed')15 logger = logging.getLogger('Skins.release_bed') 16 16 17 17 request = context.REQUEST … … 36 36 #set_trace() 37 37 if student_id is not None: 38 logger.info(' "%s", "requests bed_release for", "%s"' % (member_id,student_id))38 logger.info('%s requests bed_release for %s' % (member_id,student_id)) 39 39 res = acco_cat(student=student_id) 40 40 if len(res) == 0: 41 logger.info(' "%s", "no bed found"' % (student_id))41 logger.info('no bed of %s found' % (student_id)) 42 42 redirect("%s/%s" % (students.absolute_url(),student_id)) 43 43 allocated_bed = res[0] … … 45 45 acco_doc = context.getContent() 46 46 acco_doc.edit(mapping={'bed':"-- cancelled by section officer --"}) 47 logger.info(' "%s", "released bed of", "%s"' % (member_id,student_id))47 logger.info('%s released bed of %s' % (member_id,student_id)) 48 48 redirect("%s" % (context.absolute_url())) 49 49 -
WAeUP_SRP/trunk/skins/waeup_accommodation/reserve_accommodation.py
r1412 r1566 12 12 13 13 import logging 14 logger = logging.getLogger('S tudent.Accommodation.Reserve')14 logger = logging.getLogger('Skins.reserve_accommodation') 15 15 16 16 #if info is None: … … 19 19 if info is None: 20 20 member_id = str(context.portal_membership.getAuthenticatedMember()) 21 logger.info(' "%s","tried to reserve accommodation"' % (member_id))21 logger.info('%s tried to reserve accommodation' % (member_id)) 22 22 return context.REQUEST.RESPONSE.redirect("%s/srp_invalid_access" % context.portal_url()) 23 23 … … 55 55 if psm == 'invalid' or info['error'] is not None: 56 56 member_id = str(context.portal_membership.getAuthenticatedMember()) 57 logger.info(' "%s", %s' % (member_id,info['error'] ))57 logger.info('%s, %s' % (member_id,info['error'] )) 58 58 if psm == 'invalid': 59 59 psm = "Please correct your input." … … 94 94 ) 95 95 else: 96 bed = already[0].bed 96 bed = already[0].bed 97 97 student.invokeFactory('StudentAccommodation',acco_id) 98 98 acco = getattr(student,acco_id)
Note: See TracChangeset for help on using the changeset viewer.