Ignore:
Timestamp:
17 Mar 2007, 07:15:19 (18 years ago)
Author:
Henrik Bettermann
Message:

now logging format Part 1

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  
    1313acco_cat = context.portal_accommodation
    1414import logging
    15 logger = logging.getLogger('Accommodation.AllocateReservedBed')
     15logger = logging.getLogger('Skins.allocate_reserved_bed')
    1616
    1717#change = REQUEST.has_key("allocate_and_change")
     
    7373    if allocate or change:
    7474        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)
    7676            break
    7777        if not bed_brain.bed_type.endswith("reserved"):
    78             psm = "Not a reserved bed: %s" % bid
     78            psm = "%s is not a reserved bed" % bid
    7979            break
    8080        if bed_brain.student and not change:
     
    8888            acco_doc = getattr(student_obj, acco_id).getContent()
    8989            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)
    9191                break
    9292        if not already:
     
    9494            break
    9595        if not bed_brain.bed_type.endswith("reserved"):
    96             psm = "Not a reserved bed: %s" % bid
     96            psm = "%s is not a reserved bed" % bid
    9797            break
    9898        if not bed_brain.student:
     
    118118        acco_doc = getattr(student_obj, acco_id).getContent()
    119119        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))
    121121    psm = "Bed %s reserved for %s %s" % (bid,sid,student.name)
    122122elif release:
     
    130130    if modify:
    131131        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))
    133133        psm = "%s removed from %s" % (student.name,bid)
    134134    else:
    135         psm = "%s removing failed from %s" % (student.name,bid)
     135        psm = "Removing of %s from bed %s failed" % (student.name,bid)
    136136
    137137mode = 'view'
  • WAeUP_SRP/trunk/skins/waeup_accommodation/change_bed.py

    r1452 r1566  
    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)
  • WAeUP_SRP/trunk/skins/waeup_accommodation/getAccoHallInfo.py

    r1445 r1566  
    5959    d['student'] = st
    6060    d['student_url'] ='%s/%s' % (students_url,st)
    61     bed = context.formatBed(sbrain.bed).split('/')
     61    bed = context.getFormattedBed(sbrain.bed).split('/')
    6262    d['bed'] = " / ".join(bed[1:])
    6363    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"
    22##bind container=container
    33##bind context=context
     
    1212FIXME: add docstring.
    1313"""
     14
     15import logging
     16logger = logging.getLogger('Skins.hall_delete')
     17member_id = str(context.portal_membership.getAuthenticatedMember())
    1418
    1519from Products.CMFCore.utils import getToolByName
     
    4145    here.manage_delObjects(ids)
    4246    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)))
    4348else:
    4449    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"
    22##bind container=container
    33##bind context=context
     
    1313"""
    1414import logging
    15 logger = logging.getLogger('Student.Accommodation.release_bed')
     15logger = logging.getLogger('Skins.release_bed')
    1616
    1717request = context.REQUEST
     
    3636#set_trace()
    3737if 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))
    3939    res = acco_cat(student=student_id)
    4040    if len(res) == 0:
    41         logger.info('"%s", "no bed found"' % (student_id))
     41        logger.info('no bed of %s found' % (student_id))
    4242        redirect("%s/%s" % (students.absolute_url(),student_id))
    4343    allocated_bed = res[0]
     
    4545    acco_doc = context.getContent()
    4646    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))
    4848    redirect("%s" % (context.absolute_url()))
    4949
  • WAeUP_SRP/trunk/skins/waeup_accommodation/reserve_accommodation.py

    r1412 r1566  
    1212
    1313import logging
    14 logger = logging.getLogger('Student.Accommodation.Reserve')
     14logger = logging.getLogger('Skins.reserve_accommodation')
    1515
    1616#if info is None:
     
    1919if info is None:
    2020    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))
    2222    return context.REQUEST.RESPONSE.redirect("%s/srp_invalid_access" % context.portal_url())
    2323
     
    5555if psm == 'invalid' or info['error'] is not None:
    5656    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'] ))
    5858    if psm == 'invalid':
    5959        psm = "Please correct your input."
     
    9494                                     )
    9595        else:
    96             bed = already[0].bed 
     96            bed = already[0].bed
    9797        student.invokeFactory('StudentAccommodation',acco_id)
    9898        acco = getattr(student,acco_id)
Note: See TracChangeset for help on using the changeset viewer.