當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。