本文整理汇总了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
示例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')