本文整理汇总了Python中Products.CMFCore.CatalogTool.CatalogTool.searchResults方法的典型用法代码示例。如果您正苦于以下问题:Python CatalogTool.searchResults方法的具体用法?Python CatalogTool.searchResults怎么用?Python CatalogTool.searchResults使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Products.CMFCore.CatalogTool.CatalogTool
的用法示例。
在下文中一共展示了CatalogTool.searchResults方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_search_restrict_manager
# 需要导入模块: from Products.CMFCore.CatalogTool import CatalogTool [as 别名]
# 或者: from Products.CMFCore.CatalogTool.CatalogTool import searchResults [as 别名]
def test_search_restrict_manager(self):
catalog = CatalogTool()
now = DateTime()
dummy = DummyContent(catalog=1)
self.loginManager()
# already expired
dummy.effective = now-4
dummy.expires = now-2
catalog.catalog_object(dummy, '/dummy')
self.assertEqual(1, len(catalog._catalog.searchResults()))
self.assertEqual(1, len(catalog.searchResults()))
self.assertEqual(1, len(catalog.searchResults(
expires={'query': now-3, 'range': 'min'})))
self.assertEqual(0, len(catalog.searchResults(
expires={'query': now-1, 'range': 'min'})))
self.assertEqual(0, len(catalog.searchResults(
expires={'query': now-3, 'range': 'max'})))
self.assertEqual(1, len(catalog.searchResults(
expires={'query': now-1, 'range': 'max'})))
self.assertEqual(1, len(catalog.searchResults(
expires={'query': (now-3, now-1), 'range': 'min:max'})))
self.assertEqual(1, len(catalog.searchResults(
expires={'query': (now-3, now-1), 'range': 'minmax'})))
self.assertEqual(1, len(catalog.searchResults(
expires={'query': now-2})))
self.assertEqual(1, len(catalog.searchResults(
expires={'query': now-2, 'range': None})))
示例2: test_search_restrict_inactive
# 需要导入模块: from Products.CMFCore.CatalogTool import CatalogTool [as 别名]
# 或者: from Products.CMFCore.CatalogTool.CatalogTool import searchResults [as 别名]
def test_search_restrict_inactive(self):
catalog = CatalogTool()
now = DateTime()
dummy = DummyContent(catalog=1)
dummy._View_Permission = ('Blob',)
self.loginWithRoles('Blob')
# already expired
dummy.effective = now-4
dummy.expires = now-2
catalog.catalog_object(dummy, '/dummy')
self.assertEqual(1, len(catalog._catalog.searchResults()))
self.assertEqual(0, len(catalog.searchResults()))
self.assertEqual(0, len(catalog.searchResults(
expires={'query': now-3, 'range': 'min'})))
self.assertEqual(0, len(catalog.searchResults(
expires={'query': now-3, 'range': 'max'})))
self.assertEqual(0, len(catalog.searchResults(
expires={'query': now+3, 'range': 'min'})))
self.assertEqual(0, len(catalog.searchResults(
expires={'query': now+3, 'range': 'max'})))
self.assertEqual(0, len(catalog.searchResults(
expires={'query': (now-3, now-1), 'range': 'min:max'})))
self.assertEqual(0, len(catalog.searchResults(
expires={'query': (now-3, now-1), 'range': 'minmax'})))
self.assertEqual(0, len(catalog.searchResults(
expires={'query': now-2, 'range': None})))
示例3: test_search_anonymous
# 需要导入模块: from Products.CMFCore.CatalogTool import CatalogTool [as 别名]
# 或者: from Products.CMFCore.CatalogTool.CatalogTool import searchResults [as 别名]
def test_search_anonymous(self):
catalog = CatalogTool()
dummy = DummyContent(catalog=1)
catalog.catalog_object(dummy, '/dummy')
self.assertEqual(1, len(catalog._catalog.searchResults()))
self.assertEqual(0, len(catalog.searchResults()))
示例4: test_search_inactive
# 需要导入模块: from Products.CMFCore.CatalogTool import CatalogTool [as 别名]
# 或者: from Products.CMFCore.CatalogTool.CatalogTool import searchResults [as 别名]
def test_search_inactive(self):
catalog = CatalogTool()
now = DateTime()
dummy = DummyContent(catalog=1)
dummy._View_Permission = ('Blob',)
self.loginWithRoles('Blob')
# not yet effective
dummy.effective = now+1
dummy.expires = now+2
catalog.catalog_object(dummy, '/dummy')
self.assertEqual(1, len(catalog._catalog.searchResults()))
self.assertEqual(0, len(catalog.searchResults()))
# already expired
dummy.effective = now-2
dummy.expires = now-1
catalog.catalog_object(dummy, '/dummy')
self.assertEqual(1, len(catalog._catalog.searchResults()))
self.assertEqual(0, len(catalog.searchResults()))