core.py 文件源码

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

项目:books.archivelab.org 作者: ArchiveLabs 项目源码 文件源码
def exists(cls, *args, **kwargs):
        terms = None
        if len(args) == 1:
            if not isinstance(args[0], ClauseElement):
                terms = [getattr(cls, cls.PKEY) == args[0]]

        if not terms:
            terms = list(args) + \
                [getattr(cls, k) == v for k, v in kwargs.items()]

        res = db.query(getattr(cls, cls.PKEY)).filter(*terms).limit(1).first()
        if res:
            return res.id
        return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号