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


Python POINTS_OF_CAPTURE.keys方法代码示例

本文整理汇总了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
开发者ID:lemoene,项目名称:Bika-LIMS,代码行数:31,代码来源:serviceswidget.py


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