Skip to content

Commit

Permalink
Support for try valid on bag retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Nov 30, 2020
1 parent b36f50a commit f1390c0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/budy/controllers/api/bag.py
Expand Up @@ -67,12 +67,11 @@ def key(self):
@appier.route("/api/bags/<str:key>", "GET", json = True)
def show(self, key):
ensure = self.field("ensure", True, cast = bool)
try_valid = self.field("try_valid", True, cast = bool)
bag = budy.Bag.get(key = key, raise_e = not ensure)
if not bag: bag = budy.Bag.ensure_s(key = key)
bag.refresh_s(
currency = self.currency,
country = self.country
)
bag.refresh_s(currency = self.currency, country = self.country)
if try_valid: bag.try_valid()
bag = bag.reload(
eager = (
"lines.product.images",
Expand Down

0 comments on commit f1390c0

Please sign in to comment.