Beispiel #1
0
    def find_price(self, ctx):

        price = self.load_price(ctx.price_id)
        return Success(price=price)
Beispiel #2
0
 def age_gte_18(self, ctx):
     if not hasattr(ctx, "access_allowed") and ctx.age >= 18:
         ctx.access_allowed = True
         return Success()
     return Success()
Beispiel #3
0
 def start(self, ctx):
     ctx.foo = ctx.spam - 1
     return Success()
Beispiel #4
0
 async def two(self, ctx):
     return Success()
Beispiel #5
0
 async def before(self, ctx):
     return Success()
Beispiel #6
0
    def find_category(self, ctx):

        category = self.load_category(ctx.category_id)
        return Success(category=category)
Beispiel #7
0
    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)
Beispiel #10
0
    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)
Beispiel #11
0
    def prepare_subscription_notification(self, ctx):

        notification = Notification(profile=ctx.profile,
                                    kind=NotificationKind.subscription)
        return Success(notifications=[notification])
Beispiel #12
0
    def persist_payment(self, ctx):

        self.decrease_balance(ctx.profile, ctx.price.cost)
        return Success()
Beispiel #13
0
    def check_balance(self, ctx):

        if ctx.profile.can_afford(ctx.price):
            return Success()
        else:
            return Failure()
Beispiel #14
0
    def find_profile(self, ctx):

        profile = self.load_profile(ctx.profile_id)
        return Success(profile=profile)
Beispiel #15
0
 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)
Beispiel #17
0
 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)
Beispiel #19
0
    def check_expiration(self, ctx):

        if ctx.subscription.is_expired():
            return Failure()
        else:
            return Success()
Beispiel #20
0
 def start(self, ctx):
     return Success()
Beispiel #21
0
 async def age_lt_18(self, ctx):
     if ctx.age < 18:
         ctx.access_allowed = False
         return Success()
     return Success()
Beispiel #22
0
 def start(self, ctx):
     return Success(foo="1", bar=["2"], baz="1")
Beispiel #23
0
 async def three(self, ctx):
     return Success()
Beispiel #24
0
 def finish(self, ctx):
     return Success()
Beispiel #25
0
 async def after(self, ctx):
     return Success()
Beispiel #26
0
 def one(self, ctx):
     return Success(foo="<boom>", bar=["<boom>"])
Beispiel #27
0
 def one(self, ctx):
     return Success()
Beispiel #28
0
 def one(self, ctx):
     return Success(spam="0", quiz="1")
Beispiel #29
0
 def before(self, ctx):
     ctx.bar = ctx.spam + 1
     return Success()
Beispiel #30
0
    def find_profile(self, ctx):

        profile = self.impl.load_profile(ctx.user)
        return Success(profile=profile)