Fixed a bug introduced in 1f08dfd

This commit is contained in:
Raphael Michel
2015-06-28 17:39:58 +02:00
parent 12b81449a3
commit 765076540a
2 changed files with 7 additions and 4 deletions

View File

@@ -156,7 +156,6 @@ In our example, the implementation could look like this::
# Therefore, it is only available inside one of the timeframes, but not
# without any timeframe
available = False
price = None
# Make up some unique key for this variation
cachekey = 'timerestriction:%d:%s' % (
@@ -190,7 +189,9 @@ In our example, the implementation could look like this::
available = True
prices.append(restriction.price)
price = min([p for p in prices if p is not None])
# Use the lowest of all prices set by restrictions
prices = [p for p in prices if p is not None]
price = min(prices) if prices else None
v['available'] = available
v['price'] = price

View File

@@ -60,7 +60,6 @@ def availability_handler(sender, **kwargs):
# Therefore, it is only available inside one of the timeframes, but not
# without any timeframe
available = False
price = None
# Make up some unique key for this variation
cachekey = 'timerestriction:%s:%s' % (
@@ -94,7 +93,10 @@ def availability_handler(sender, **kwargs):
available = True
prices.append(restriction.price)
price = min([p for p in prices if p is not None])
# Use the lowest of all prices set by restrictions
prices = [p for p in prices if p is not None]
price = min(prices) if prices else None
v['available'] = available
v['price'] = price
cache.set(