当前位置: 首页>>代码示例>>Python>>正文


Python Account._byID36方法代码示例

本文整理汇总了Python中r2.models.account.Account._byID36方法的典型用法代码示例。如果您正苦于以下问题:Python Account._byID36方法的具体用法?Python Account._byID36怎么用?Python Account._byID36使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在r2.models.account.Account的用法示例。


在下文中一共展示了Account._byID36方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: check_valid

# 需要导入模块: from r2.models.account import Account [as 别名]
# 或者: from r2.models.account.Account import _byID36 [as 别名]
    def check_valid(self):
        """Returns boolean indicating whether or not this access token is still valid."""

        # Has the token been revoked?
        if getattr(self, 'revoked', False):
            return False

        # Is the OAuth2Client still valid?
        try:
            client = OAuth2Client._byID(self.client_id)
            if getattr(client, 'deleted', False):
                raise NotFound
        except NotFound:
            return False

        # Is the user account still valid?
        if self.user_id:
            try:
                account = Account._byID36(self.user_id)
                if account._deleted:
                    raise NotFound
            except NotFound:
                return False

        return True
开发者ID:njs0630,项目名称:reddit,代码行数:27,代码来源:token.py

示例2: revoke

# 需要导入模块: from r2.models.account import Account [as 别名]
# 或者: from r2.models.account.Account import _byID36 [as 别名]
 def revoke(self):
     super(OAuth2RefreshToken, self).revoke()
     account = Account._byID36(self.user_id)
     access_tokens = OAuth2AccessToken._by_user(account)
     for token in access_tokens:
         if token.refresh_token == self._id:
             token.revoke()
开发者ID:njs0630,项目名称:reddit,代码行数:9,代码来源:token.py

示例3: get_editor_accounts

# 需要导入模块: from r2.models.account import Account [as 别名]
# 或者: from r2.models.account.Account import _byID36 [as 别名]
 def get_editor_accounts(self):
     editors = self.get_editors()
     accounts = [Account._byID36(editor, data=True)
                 for editor in self.get_editors()]
     accounts = [account for account in accounts
                 if not account._deleted]
     return accounts
开发者ID:99plus2,项目名称:reddit,代码行数:9,代码来源:wiki.py

示例4: check_valid

# 需要导入模块: from r2.models.account import Account [as 别名]
# 或者: from r2.models.account.Account import _byID36 [as 别名]
    def check_valid(self):
        if getattr(self, 'revoked', False):
            return False

        try:
            client = OAuth2Client._byID(self.client_id)
            if getattr(client, 'deleted', False):
                raise NotFound
        except AttributeError:
            g.log.error("bad token %s: %s", self, self._t)
            raise
        except NotFound:
            return False

        if self.user_id:
            try:
                account = Account._byID36(self.user_id)
                if account._deleted:
                    raise NotFound
            except NotFound:
                return False

        return True
开发者ID:zeantsoi,项目名称:reddit,代码行数:25,代码来源:token.py

示例5: get_authors

# 需要导入模块: from r2.models.account import Account [as 别名]
# 或者: from r2.models.account.Account import _byID36 [as 别名]
 def get_authors(cls, revisions):
     authors = [r._get('author') for r in revisions]
     authors = filter(None, authors)
     return Account._byID36(authors, data=True)
开发者ID:99plus2,项目名称:reddit,代码行数:6,代码来源:wiki.py

示例6: get_author

# 需要导入模块: from r2.models.account import Account [as 别名]
# 或者: from r2.models.account.Account import _byID36 [as 别名]
 def get_author(self):
     author = self._get('author')
     return Account._byID36(author, data=True) if author else None
开发者ID:99plus2,项目名称:reddit,代码行数:5,代码来源:wiki.py


注:本文中的r2.models.account.Account._byID36方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。