本文整理匯總了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()))