示例#1
0
    def find_price(self, ctx):

        price = self.load_price(ctx.price_id)
        return Success(price=price)
示例#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()
示例#3
0
 def start(self, ctx):
     ctx.foo = ctx.spam - 1
     return Success()
示例#4
0
 async def two(self, ctx):
     return Success()
示例#5
0
 async def before(self, ctx):
     return Success()
示例#6
0
    def find_category(self, ctx):

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

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

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

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

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

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

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