Ignore:
Timestamp:
19 Mar 2007, 18:57:54 (18 years ago)
Author:
uli
Message:

Merged current trunk into uli-branch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/branches/uli/skins/waeup_accommodation/change_bed.py

    r1452 r1593  
    1313"""
    1414import logging
    15 logger = logging.getLogger('Student.Accommodation.change_bed')
     15logger = logging.getLogger('Skins.change_bed')
    1616
    1717request = context.REQUEST
     
    3131
    3232if 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))
    3434    info = context.getAccommodationInfo(student_id)
    3535    res = beds(student=student_id)
    3636    if len(res) == 0:
    37         logger.info('"%s", "no bed found"' % (student_id))
    38         redirect("%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))
    3939    allocated_bed = res[0]
    4040    status = info['student_status']
    4141    student = student_id
    4242    if allocated_bed.bed_type == status:
    43         logger.info('"%s", "correct bed allocated","%s"' % (student_id,status))
    44         redirect("%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))
    4646    beds.modifyRecord(bed=allocated_bed.bed,student='')
     47    logger.info('Bed %s released' % (allocated_bed.bed))
    4748    code,bed = beds.searchAndReserveBed(student_id,status)
    4849    if code > 0:
     
    5657        acco_doc = info['acco_doc']
    5758        acco_doc.edit(mapping=d)
     59        logger.info('Bed %s allocated to %s' % (bed,student_id))
    5860        return redirect("%s/%s/%s" % (students.absolute_url(),student,info['acco_id']))
    5961    student_obj = getattr(students,student_id)
     
    6264        acco_doc = getattr(student_obj, acco_id).getContent()
    6365        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))
    6769    redirect("%s/%s/%s" % (students.absolute_url(),student,info['acco_id']))
    6870
     
    9597        d['acco_maint_fee'] = acco_info.get('maintenance_fee')
    9698        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,
    99101                                                              code))
    100102return "\r".join(list)
Note: See TracChangeset for help on using the changeset viewer.