source: WAeUP_SRP/trunk/skins/waeup_accommodation/reservedRoomsVoc.py @ 6086

Last change on this file since 6086 was 3254, checked in by joachim, 17 years ago

raise KeyError? if key is not in Vocabulary

  • Property svn:keywords set to Id
File size: 414 bytes
RevLine 
[1447]1##parameters=key=None,doc=None
[1393]2# $Id: reservedRoomsVoc.py 3254 2008-02-28 13:06:20Z joachim $
3"""
4Return the reservedrooms as an vocabulary
5
6"""
[1447]7if doc is None:
8    doc = context.getContent()
9voc = [("_".join((r.split('/')[0].strip(),r.split('/')[1].strip())),r)
10                      for r in doc.reserved_rooms.split(',') if r]
[1393]11#from Products.zdb import set_trace;set_trace()
12if not key:
13    return voc
14for k,v in voc:
15    if k == key:
16        return v
[3254]17raise KeyError
Note: See TracBrowser for help on using the repository browser.