当前位置: 首页>>代码示例>>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;未经允许,请勿转载。