## Script (Python) "getFormattedBed"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=bed=None,mode=None,datastructure=None
##title=
# $Id: getFormattedBed.py 1453 2007-02-20 22:24:30Z henrik $
"""
format the bed for readability
"""

if datastructure is not None:
    bed = datastructure.get('bed')
if not bed:
    return ''
if len(bed.split('_')) != 4:
    return bed
hall,block,room,letter = bed.split('_')
info = context.waeup_tool.getHallInfo(bed)
if info:
    hall_title = info['hall_title']
else:
    hall_title = '[%s]' % hall
return " %s / Block %s / Room %s / Bed %s" % (hall_title,block,room,letter)

