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

Last change on this file since 8296 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
Line 
1##parameters=key=None,doc=None
2# $Id: reservedRoomsVoc.py 3254 2008-02-28 13:06:20Z joachim $
3"""
4Return the reservedrooms as an vocabulary
5
6"""
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]
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
17raise KeyError
Note: See TracBrowser for help on using the repository browser.