本文整理匯總了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