summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/test/store-python/fruits-catalog.py
blob: ea71e93b222a6f6513c63093b95326b60ea8cc69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Catalog implementation

def get(converter):
  def convert(price):
      return converter("convert", "USD", "USD", price)
  code = "USD"
  symbol = converter("symbol", code)
  return (
    (("'javaClass", "services.Item"), ("'name", "Apple"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(2.99))),
    (("'javaClass", "services.Item"), ("'name", "Orange"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(3.55))),
    (("'javaClass", "services.Item"), ("'name", "Pear"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(1.55)))
  )

# TODO remove these JSON-RPC specific functions
def listMethods(converter):
    return ("Service.get",)