def find_price(self, ctx): price = self.load_price(ctx.price_id) return Success(price=price)
def age_gte_18(self, ctx): if not hasattr(ctx, "access_allowed") and ctx.age >= 18: ctx.access_allowed = True return Success() return Success()
def start(self, ctx): ctx.foo = ctx.spam - 1 return Success()
async def two(self, ctx): return Success()
async def before(self, ctx): return Success()
def find_category(self, ctx): category = self.load_category(ctx.category_id) return Success(category=category)
def find_entries(self, ctx): entries = self.load_entries(ctx.category) return Success(entries=entries)
def find_categories(self, ctx): categories = self.impl.load_categories() return Success(categories=categories)
def keep_without_subscriptions(self, ctx): categories = self.impl.exclude_subscriptions(ctx.categories, ctx.user) return Success(no_subscriptions=categories)
def persist_subscription(self, ctx): expires = ctx.price.subscription_will_expire(self.current_date()) subscription = self.create_subscription(ctx.profile, ctx.category, expires) return Success(subscription=subscription)
def prepare_subscription_notification(self, ctx): notification = Notification(profile=ctx.profile, kind=NotificationKind.subscription) return Success(notifications=[notification])
def persist_payment(self, ctx): self.decrease_balance(ctx.profile, ctx.price.cost) return Success()
def check_balance(self, ctx): if ctx.profile.can_afford(ctx.price): return Success() else: return Failure()
def find_profile(self, ctx): profile = self.load_profile(ctx.profile_id) return Success(profile=profile)
def one(self, ctx): value = {"key": "1"} return Success(foo=value, bar=value, baz=value)
def keep_with_prices(self, ctx): categories = self.impl.filter_prices(ctx.no_subscriptions) return Success(with_prices=categories)
def before(self, ctx): return Success(foo="1", bar=["2"])
def find_cheapest_prices(self, ctx): prices = self.impl.load_prices(ctx.with_prices) return Success(prices=prices)
def check_expiration(self, ctx): if ctx.subscription.is_expired(): return Failure() else: return Success()
def start(self, ctx): return Success()
async def age_lt_18(self, ctx): if ctx.age < 18: ctx.access_allowed = False return Success() return Success()
def start(self, ctx): return Success(foo="1", bar=["2"], baz="1")
async def three(self, ctx): return Success()
def finish(self, ctx): return Success()
async def after(self, ctx): return Success()
def one(self, ctx): return Success(foo="<boom>", bar=["<boom>"])
def one(self, ctx): return Success()
def one(self, ctx): return Success(spam="0", quiz="1")
def before(self, ctx): ctx.bar = ctx.spam + 1 return Success()
def find_profile(self, ctx): profile = self.impl.load_profile(ctx.user) return Success(profile=profile)