当前位置: 首页>>代码示例>>Python>>正文


Python ICatalogTool.count方法代码示例

本文整理汇总了Python中Products.Zuul.interfaces.ICatalogTool.count方法的典型用法代码示例。如果您正苦于以下问题:Python ICatalogTool.count方法的具体用法?Python ICatalogTool.count怎么用?Python ICatalogTool.count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Products.Zuul.interfaces.ICatalogTool的用法示例。


在下文中一共展示了ICatalogTool.count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: hidden

# 需要导入模块: from Products.Zuul.interfaces import ICatalogTool [as 别名]
# 或者: from Products.Zuul.interfaces.ICatalogTool import count [as 别名]
    def hidden(self):
        """
        Make sure we don't show the root node of a tree
        if we don't have permission on it or any of its children
        """
        # always show the root Device organizer so restricted users can see
        # all of the devices they have access to
        if self.uid == '/zport/dmd/Devices':
            return False

        # make sure we are looking at a root node
        pieces = self.uid.split('/')
        if len(pieces) != 4:
            return False

        # check for our permission
        manager = getSecurityManager()
        obj = self._object.unrestrictedTraverse(self.uid)
        if manager.checkPermission("View", obj):
            return False

        # search the catalog to see if we have permission with any of the children
        cat = ICatalogTool(obj)
        numInstances = cat.count('Products.ZenModel.DeviceOrganizer.DeviceOrganizer', self.uid)


        # if anything is returned we have view permissions on a child
        return not numInstances > 0
开发者ID:zenoss,项目名称:zenoss-prodbin,代码行数:30,代码来源:tree.py

示例2: deviceCount

# 需要导入模块: from Products.Zuul.interfaces import ICatalogTool [as 别名]
# 或者: from Products.Zuul.interfaces.ICatalogTool import count [as 别名]
 def deviceCount(self, uid=None):
     cat = ICatalogTool(self._getObject(uid))
     return cat.count('Products.ZenModel.Device.Device')
开发者ID:ssbunyk,项目名称:zenoss-prodbin,代码行数:5,代码来源:__init__.py


注:本文中的Products.Zuul.interfaces.ICatalogTool.count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。