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


Python ICollection.getFoldersAndImages方法代码示例

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


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

示例1: test_getFoldersAndImages_returning_images

# 需要导入模块: from plone.app.contenttypes.behaviors.collection import ICollection [as 别名]
# 或者: from plone.app.contenttypes.behaviors.collection.ICollection import getFoldersAndImages [as 别名]
    def test_getFoldersAndImages_returning_images(self):
        portal = self.layer['portal']
        login(portal, 'admin')
        # add a collection, so we can add a query to it
        portal.invokeFactory("Collection",
                             "collection",
                             title="New Collection")

        # add example folder
        portal.invokeFactory("Folder",
                             "folder1",
                             title="Folder1")
        folder = portal['folder1']

        # add example image into this folder
        folder.invokeFactory("Image",
                             "image",
                             title="Image example")

        # add another image into the portal root
        portal.invokeFactory("Image",
                             "image",
                             title="Image example")
        query = [{
            'i': 'Type',
            'o': 'plone.app.querystring.operation.string.is',
            'v': 'Image',
        }]
        collection = portal['collection']
        wrapped = ICollection_behavior(collection)
        wrapped.query = query
        imagecount = wrapped.getFoldersAndImages()['total_number_of_images']
        self.assertEqual(imagecount, 2)
开发者ID:martior,项目名称:plone.app.contenttypes,代码行数:35,代码来源:test_collection.py

示例2: test_getFoldersAndImages_returning_images

# 需要导入模块: from plone.app.contenttypes.behaviors.collection import ICollection [as 别名]
# 或者: from plone.app.contenttypes.behaviors.collection.ICollection import getFoldersAndImages [as 别名]
    def test_getFoldersAndImages_returning_images(self):
        portal = self.layer["portal"]
        login(portal, "admin")
        # add a collection, so we can add a query to it
        portal.invokeFactory("Collection", "collection", title="New Collection")

        # add example folder
        portal.invokeFactory("Folder", "folder1", title="Folder1")
        folder = portal["folder1"]

        # add example image into this folder
        folder.invokeFactory("Image", "image", title="Image example")

        # add another image into the portal root
        portal.invokeFactory("Image", "image", title="Image example")
        query = [{"i": "Type", "o": "plone.app.querystring.operation.string.is", "v": "Image"}]
        collection = portal["collection"]
        wrapped = ICollection_behavior(collection)
        wrapped.query = query
        imagecount = wrapped.getFoldersAndImages()["total_number_of_images"]
        self.assertEqual(imagecount, 2)
开发者ID:naro,项目名称:plone.app.contenttypes,代码行数:23,代码来源:test_collection.py

示例3: test_getFoldersAndImages

# 需要导入模块: from plone.app.contenttypes.behaviors.collection import ICollection [as 别名]
# 或者: from plone.app.contenttypes.behaviors.collection.ICollection import getFoldersAndImages [as 别名]
    def test_getFoldersAndImages(self):
        portal = self.layer['portal']
        login(portal, 'admin')
        # add a collection, so we can add a query to it
        portal.invokeFactory("Collection",
                             "collection",
                             title="New Collection")

        # add example folder and a subfolder to it, both with same id
        portal.invokeFactory("Folder",
                             "folder1",
                             title="Folder1")
        folder = portal['folder1']

        folder.invokeFactory("Folder",
                             "folder1",
                             title="Folder1")
        subfolder = folder['folder1']
        # add example image into folder and its subfolder
        folder.invokeFactory("Image",
                             "image",
                             title="Image example")

        subfolder.invokeFactory("Image",
                                "another_image",
                                title="Image example")
        query = [{
            'i': 'Type',
            'o': 'plone.app.querystring.operation.string.is',
            'v': 'Folder',
        }]
        collection = portal['collection']
        wrapped = ICollection_behavior(collection)
        wrapped.query = query
        imagecount = wrapped.getFoldersAndImages()['total_number_of_images']
        # The current implementation for getFoldersAndImages will return
        # another_image under subfolder and also under folder
        self.assertEqual(imagecount, 3)
开发者ID:martior,项目名称:plone.app.contenttypes,代码行数:40,代码来源:test_collection.py

示例4: test_getFoldersAndImages

# 需要导入模块: from plone.app.contenttypes.behaviors.collection import ICollection [as 别名]
# 或者: from plone.app.contenttypes.behaviors.collection.ICollection import getFoldersAndImages [as 别名]
    def test_getFoldersAndImages(self):
        portal = self.layer["portal"]
        login(portal, "admin")
        # add a collection, so we can add a query to it
        portal.invokeFactory("Collection", "collection", title="New Collection")

        # add example folder and a subfolder to it, both with same id
        portal.invokeFactory("Folder", "folder1", title="Folder1")
        folder = portal["folder1"]

        folder.invokeFactory("Folder", "folder1", title="Folder1")
        subfolder = folder["folder1"]
        # add example image into folder and its subfolder
        folder.invokeFactory("Image", "image", title="Image example")

        subfolder.invokeFactory("Image", "another_image", title="Image example")
        query = [{"i": "Type", "o": "plone.app.querystring.operation.string.is", "v": "Folder"}]
        collection = portal["collection"]
        wrapped = ICollection_behavior(collection)
        wrapped.query = query
        imagecount = wrapped.getFoldersAndImages()["total_number_of_images"]
        # The current implementation for getFoldersAndImages will return
        # another_image under subfolder and also under folder
        self.assertEqual(imagecount, 3)
开发者ID:naro,项目名称:plone.app.contenttypes,代码行数:26,代码来源:test_collection.py

示例5: getFoldersAndImages

# 需要导入模块: from plone.app.contenttypes.behaviors.collection import ICollection [as 别名]
# 或者: from plone.app.contenttypes.behaviors.collection.ICollection import getFoldersAndImages [as 别名]
 def getFoldersAndImages(self, **kwargs):
     context = aq_inner(self.context)
     wrapped = ICollection(context)
     return wrapped.getFoldersAndImages(**kwargs)
开发者ID:UPCnet,项目名称:ulearn.theme,代码行数:6,代码来源:views.py


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