utils.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:munch-core 作者: crunchmail 项目源码 文件源码
def get_identifier(self):
        """ Gets the instance, if token is valid.

        :param klass: the class (must be model.Model instance)
        May throw DoesNotExist
        :returns: instance if signature is ok, None else.
        """
        try:
            payload = signing.Signer().unsign(self.token)
        except signing.BadSignature:
            return None
        else:
            d = json.loads(force_text(urlsafe_base64_decode(payload)))
            return d.get('identifier')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号