本文整理汇总了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)
示例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)
示例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)
示例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)
示例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)