當前位置: 首頁>>代碼示例>>Python>>正文


Python CatalogTool.catalog_object方法代碼示例

本文整理匯總了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})))
開發者ID:goschtl,項目名稱:zope,代碼行數:32,代碼來源:test_CatalogTool.py

示例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()))
開發者ID:goschtl,項目名稱:zope,代碼行數:9,代碼來源:test_CatalogTool.py

示例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})))
開發者ID:goschtl,項目名稱:zope,代碼行數:31,代碼來源:test_CatalogTool.py

示例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' ] )
開發者ID:goschtl,項目名稱:zope,代碼行數:12,代碼來源:test_CatalogTool.py

示例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()))
開發者ID:goschtl,項目名稱:zope,代碼行數:23,代碼來源:test_CatalogTool.py


注:本文中的Products.CMFCore.CatalogTool.CatalogTool.catalog_object方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。