def get_allocation_price(self, resource, name=None, today=None):
quota = self.get_quota(resource, name)
if quota == -1:
return 0
if today is None:
today = date.today()
rate = self.get_rate(resource, name)
#month_range = calendar.monthrange(today.year, today.month)[1]
# for variable month days/hours
#price = decimal.Decimal('0.24') * rate * decimal.Decimal(quota) * decimal.Decimal(month_range)
# for fixed month days/hours: 730
price = D('73.0') * rate * decimal.Decimal(quota)
return price
评论列表
文章目录