コード例 #1
0
    def find_price(self, ctx):

        price = self.load_price(ctx.price_id)
        return Success(price=price)
コード例 #2
0
ファイル: functions.py プロジェクト: proofit404/stories
 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
ファイル: functions.py プロジェクト: proofit404/stories
 def start(self, ctx):
     ctx.foo = ctx.spam - 1
     return Success()
コード例 #4
0
ファイル: coroutines.py プロジェクト: magican/stories
 async def two(self, ctx):
     return Success()
コード例 #5
0
ファイル: coroutines.py プロジェクト: magican/stories
 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)
コード例 #8
0
    def find_categories(self, ctx):

        categories = self.impl.load_categories()
        return Success(categories=categories)
コード例 #9
0
    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)
コード例 #16
0
    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"])
コード例 #18
0
    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
ファイル: coroutines.py プロジェクト: magican/stories
 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
ファイル: coroutines.py プロジェクト: magican/stories
 async def three(self, ctx):
     return Success()
コード例 #24
0
 def finish(self, ctx):
     return Success()
コード例 #25
0
ファイル: coroutines.py プロジェクト: magican/stories
 async def after(self, ctx):
     return Success()
コード例 #26
0
 def one(self, ctx):
     return Success(foo="<boom>", bar=["<boom>"])
コード例 #27
0
ファイル: functions.py プロジェクト: proofit404/stories
 def one(self, ctx):
     return Success()
コード例 #28
0
 def one(self, ctx):
     return Success(spam="0", quiz="1")
コード例 #29
0
ファイル: functions.py プロジェクト: proofit404/stories
 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)