Пример #1
0
    def engolden(self, account):
        now = datetime.now(g.display_tz)
        account.gold = True
        description = "Since " + now.strftime("%B %Y")
        
        trophy = Award.give_if_needed("reddit_gold", account,
                                     description=description,
                                     url="/gold/about")
        if trophy and trophy.description.endswith("Member Emeritus"):
            trophy.description = description
            trophy._commit()

        account._commit()
        account.friend_rels_cache(_update=True)
Пример #2
0
    def engolden(self, account):
        now = datetime.now(g.display_tz)
        account.gold = True
        description = "Since " + now.strftime("%B %Y")
        
        trophy = Award.give_if_needed("reddit_gold", account,
                                     description=description,
                                     url="/gold/about")
        if trophy and trophy.description.endswith("Member Emeritus"):
            trophy.description = description
            trophy._commit()

        account._commit()
        account.friend_rels_cache(_update=True)
Пример #3
0
    def engolden(self, account, days):
        account.gold = True

        now = datetime.now(g.display_tz)

        existing_expiration = getattr(account, "gold_expiration", None)
        if existing_expiration is None or existing_expiration < now:
            existing_expiration = now
        account.gold_expiration = existing_expiration + timedelta(days)

        description = "Since " + now.strftime("%B %Y")
        trophy = Award.give_if_needed("reddit_gold", account, description=description, url="/gold/about")
        if trophy and trophy.description.endswith("Member Emeritus"):
            trophy.description = description
            trophy._commit()
        account._commit()

        account.friend_rels_cache(_update=True)
Пример #4
0
    def engolden(self, account, days):
        account.gold = True

        now = datetime.now(g.display_tz)

        existing_expiration = getattr(account, "gold_expiration", None)
        if existing_expiration is None or existing_expiration < now:
            existing_expiration = now
        account.gold_expiration = existing_expiration + timedelta(days)

        description = "Since " + now.strftime("%B %Y")
        trophy = Award.give_if_needed("reddit_gold", account,
                                     description=description,
                                     url="/gold/about")
        if trophy and trophy.description.endswith("Member Emeritus"):
            trophy.description = description
            trophy._commit()
        account._commit()

        account.friend_rels_cache(_update=True)