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


Python Creator.from_query方法代码示例

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


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

示例1: setUp

# 需要导入模块: from applications.zcomx.modules.creators import Creator [as 别名]
# 或者: from applications.zcomx.modules.creators.Creator import from_query [as 别名]
    def setUp(self):
        # W0212: *Access to a protected member %%s of a client class*
        # pylint: disable=W0212
        # Get a book from a creator with a paypal_email.
        self._book = db(db.creator.paypal_email != '').select(
            db.book.ALL,
            left=[
                db.creator.on(db.book.creator_id == db.creator.id),
                db.book_page.on(db.book_page.book_id == db.book.id)
            ],
        ).first()

        if not self._book:
            raise SyntaxError('Unable to get book.')

        max_book_id = db.book.id.max()
        rows = db().select(max_book_id)
        if rows:
            self._invalid_book_id = rows[0][max_book_id] + 1
        else:
            self._invalid_book_id = 1

        self._creator = Creator.from_query((db.creator.paypal_email != ''))
        if not self._creator:
            raise SyntaxError('Unable to get creator.')
开发者ID:zcomx,项目名称:zcomix.com,代码行数:27,代码来源:test_contributions.py

示例2: setUpClass

# 需要导入模块: from applications.zcomx.modules.creators import Creator [as 别名]
# 或者: from applications.zcomx.modules.creators.Creator import from_query [as 别名]
    def setUpClass(cls):
        # C0103: *Invalid name "%%s" (should match %%s)*
        # pylint: disable=C0103
        # Get the data the tests will use.
        email = web.username
        query = (db.auth_user.email == email)
        cls._user = db(query).select(limitby=(0, 1)).first()
        if not cls._user:
            msg = 'No user with email: {e}'.format(e=email)
            print msg
            raise SyntaxError(msg)

        query = db.creator.auth_user_id == cls._user.id
        cls._creator = Creator.from_query(query)
        if not cls._creator:
            msg = 'No creator with email: {e}'.format(e=email)
            print msg
            raise SyntaxError(msg)

        cls._creator_as_dict = cls._creator.as_dict()

        query = (db.book.creator_id == cls._creator.id) & \
                (db.book.name_for_url == 'TestDoNotDelete-001')
        cls._book = Book.from_query(query)
        cls._book_page = get_page(cls._book, page_no='first')

        id_max = db.optimize_img_log.id.max()
        cls._max_optimize_img_log_id = \
            db(db.optimize_img_log).select(id_max)[0][id_max]
        cls._test_data_dir = os.path.join(request.folder, 'private/test/data/')
开发者ID:zcomx,项目名称:zcomix.com,代码行数:32,代码来源:test_login.py


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