def list(self, owner, type=None, exclude_tariffs=True): """ type: filter by specified type returns list of resource info dicts """ fields=['id', 'name', 'short_description', 'long_description', 'calc_mode', 'type', 'enabled', 'host_only', 'picture', 'archived', 'accnt_code'] resource_list = dbaccess.list_resources_and_tariffs(owner, fields, type, exclude_tariffs) return resource_list
def by_location(owner): """ returns pricing for ALL the resources for each tariff defined for this location """ default_tariff_id = dbaccess.bizplace_store.get(owner).default_tariff result = dbaccess.list_resources_and_tariffs(owner, ['id','name'], type='tariff') for rec in result: if rec['id'] == default_tariff_id : rec['is_guest_tariff'] = 1 else: rec['is_guest_tariff'] = 0 prices = pricing_store.get_by(crit=dict(plan=rec['id']), fields=['id','resource','amount']) price_per_resource = {} for p in prices : price_per_resource[p['resource']] = p del p['resource'] rec['pricings'] = price_per_resource return result