##parameters=key=None
# $Id: getScratchCardCost.py 3070 2008-01-30 19:34:03Z joachim $
"""
Return the scratchcard-cost as an vocabulary

"""
if key is None:
    res = context.portal_catalog.search({'portal_type': "ScratchCardBatch"})    
    return [(d.getId,d.getObject().getContent().cost) for d in res]
res = context.portal_catalog.search({'portal_type': "ScratchCardBatch", 'id': key})
if res:
    return res[-1].getObject().getContent().cost
return "unknown batch %s" % key

