本文整理匯總了Python中Products.CMFCore.CatalogTool.CatalogTool.catalog_object方法的典型用法代碼示例。如果您正苦於以下問題:Python CatalogTool.catalog_object方法的具體用法?Python CatalogTool.catalog_object怎麽用?Python CatalogTool.catalog_object使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Products.CMFCore.CatalogTool.CatalogTool
的用法示例。
在下文中一共展示了CatalogTool.catalog_object方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_search_restrict_manager
# 需要導入模塊: from Products.CMFCore.CatalogTool import CatalogTool [as 別名]
# 或者: from Products.CMFCore.CatalogTool.CatalogTool import catalog_object [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_anonymous
# 需要導入模塊: from Products.CMFCore.CatalogTool import CatalogTool [as 別名]
# 或者: from Products.CMFCore.CatalogTool.CatalogTool import catalog_object [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()))
示例3: test_search_restrict_inactive
# 需要導入模塊: from Products.CMFCore.CatalogTool import CatalogTool [as 別名]
# 或者: from Products.CMFCore.CatalogTool.CatalogTool import catalog_object [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})))
示例4: test_processActions
# 需要導入模塊: from Products.CMFCore.CatalogTool import CatalogTool [as 別名]
# 或者: from Products.CMFCore.CatalogTool.CatalogTool import catalog_object [as 別名]
def test_processActions( self ):
"""
Tracker #405: CatalogTool doesn't accept optional third
argument, 'idxs', to 'catalog_object'.
"""
tool = CatalogTool()
dummy = DummyContent(catalog=1)
tool.catalog_object( dummy, '/dummy' )
tool.catalog_object( dummy, '/dummy', [ 'SearchableText' ] )
示例5: test_search_inactive
# 需要導入模塊: from Products.CMFCore.CatalogTool import CatalogTool [as 別名]
# 或者: from Products.CMFCore.CatalogTool.CatalogTool import catalog_object [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()))