本文整理汇总了Python中bika.lims.config.POINTS_OF_CAPTURE.keys方法的典型用法代码示例。如果您正苦于以下问题:Python POINTS_OF_CAPTURE.keys方法的具体用法?Python POINTS_OF_CAPTURE.keys怎么用?Python POINTS_OF_CAPTURE.keys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bika.lims.config.POINTS_OF_CAPTURE
的用法示例。
在下文中一共展示了POINTS_OF_CAPTURE.keys方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getServices
# 需要导入模块: from bika.lims.config import POINTS_OF_CAPTURE [as 别名]
# 或者: from bika.lims.config.POINTS_OF_CAPTURE import keys [as 别名]
def getServices(self, field, selected_only = False):
""" Returns a list of Analysis Services keyed by POC and Category
selected_only - set this to return only checked services (for view widget)
returns
{('poc_id', 'Point Of Capture'):
{('cat_id', 'Category Title'): [('serviceUID','service Title'), ..]
}
}
"""
pc = getToolByName(self, 'portal_catalog')
allservices = [p.getObject() for p in pc(portal_type = "AnalysisService", sort_on='sortable_title')]
selectedservices = getattr(field, field.accessor)()
res = {}
for poc_id in POINTS_OF_CAPTURE.keys():
poc_title = POINTS_OF_CAPTURE.getValue(poc_id)
res[(poc_id, poc_title)] = {}
if selected_only:
services = selectedservices
else:
services = allservices
for service in services:
cat = (service.getCategoryUID(), service.getCategoryName())
poc = (service.getPointOfCapture(), POINTS_OF_CAPTURE.getValue(service.getPointOfCapture()))
srv = (service.UID(), service.Title())
if not res[poc].has_key(cat): res[poc][cat] = []
res[poc][cat].append(srv)
return res