本文整理汇总了Python中bika.lims.browser.reports.selection_macros.SelectionMacrosView.parse_samplepoint方法的典型用法代码示例。如果您正苦于以下问题:Python SelectionMacrosView.parse_samplepoint方法的具体用法?Python SelectionMacrosView.parse_samplepoint怎么用?Python SelectionMacrosView.parse_samplepoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bika.lims.browser.reports.selection_macros.SelectionMacrosView
的用法示例。
在下文中一共展示了SelectionMacrosView.parse_samplepoint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Report
# 需要导入模块: from bika.lims.browser.reports.selection_macros import SelectionMacrosView [as 别名]
# 或者: from bika.lims.browser.reports.selection_macros.SelectionMacrosView import parse_samplepoint [as 别名]
class Report(BrowserView):
implements(IViewView)
template = ViewPageTemplateFile(
"templates/qualitycontrol_resultspersamplepoint.pt")
# if unsuccessful we return here:
default_template = ViewPageTemplateFile("templates/qualitycontrol.pt")
def __init__(self, context, request, report=None):
super(Report, self).__init__(context, request)
self.report = report
self.selection_macros = SelectionMacrosView(self.context, self.request)
def get_analysis_spec(self, analysis):
rr = dicts_to_dict(analysis.aq_parent.getResultsRange(), 'keyword')
return rr.get(analysis.getKeyword(), None)
def ResultOutOfRange(self, analysis):
"""Template wants to know, is this analysis out of range? We scan
IResultOutOfRange adapters, and return True if any IAnalysis adapters
trigger a result. """
adapters = getAdapters((analysis, ), IResultOutOfRange)
spec = self.get_analysis_spec(analysis)
for name, adapter in adapters:
if not spec:
return False
if adapter(specification=spec):
return True
def __call__(self):
MinimumResults = self.context.bika_setup.getMinimumResults()
warning_icon = "<img " + \
"src='" + self.portal_url + "/++resource++bika.lims.images/warning.png' " + \
"height='9' width='9'/>"
error_icon = "<img " + \
"src='" + self.portal_url + "/++resource++bika.lims.images/exclamation.png' " + \
"height='9' width='9'/>"
header = _("Results per sample point")
subheader = _(
"Analysis results for per sample point and analysis service")
self.contentFilter = {'portal_type': 'Analysis',
'review_state': ['verified', 'published']}
parms = []
titles = []
val = self.selection_macros.parse_client(self.request)
if val:
self.contentFilter[val['contentFilter'][0]] = val['contentFilter'][1]
parms.append(val['parms'])
titles.append(val['titles'])
val = self.selection_macros.parse_samplepoint(self.request)
sp_uid = val
if val:
self.contentFilter[val['contentFilter'][0]] = val['contentFilter'][1]
parms.append(val['parms'])
titles.append(val['titles'])
val = self.selection_macros.parse_sampletype(self.request)
st_uid = val
if val:
self.contentFilter[val['contentFilter'][0]] = val['contentFilter'][1]
parms.append(val['parms'])
titles.append(val['titles'])
val = self.selection_macros.parse_analysisservice(self.request)
if val:
self.contentFilter[val['contentFilter'][0]] = val['contentFilter'][1]
parms.append(val['parms'])
else:
message = _("No analysis services were selected.")
self.context.plone_utils.addPortalMessage(message, 'error')
return self.default_template()
val = self.selection_macros.parse_daterange(self.request,
'getDateSampled',
'DateSampled')
if val:
self.contentFilter[val['contentFilter'][0]] = val['contentFilter'][1]
parms.append(val['parms'])
titles.append(val['titles'])
val = self.selection_macros.parse_state(self.request,
'bika_worksheetanalysis_workflow',
'worksheetanalysis_review_state',
'Worksheet state')
if val:
self.contentFilter[val['contentFilter'][0]] = val['contentFilter'][1]
parms.append(val['parms'])
# Query the catalog and store analysis data in a dict
analyses = {}
out_of_range_count = 0
in_shoulder_range_count = 0
analysis_count = 0
proxies = self.bika_analysis_catalog(self.contentFilter)
#.........这里部分代码省略.........
示例2: Report
# 需要导入模块: from bika.lims.browser.reports.selection_macros import SelectionMacrosView [as 别名]
# 或者: from bika.lims.browser.reports.selection_macros.SelectionMacrosView import parse_samplepoint [as 别名]
class Report(BrowserView):
implements(IViewView)
template = ViewPageTemplateFile("templates/qualitycontrol_resultspersamplepoint.pt")
# if unsuccessful we return here:
default_template = ViewPageTemplateFile("templates/qualitycontrol.pt")
def __init__(self, context, request, report=None):
super(Report, self).__init__(context, request)
self.report = report
self.selection_macros = SelectionMacrosView(self.context, self.request)
def __call__(self):
MinimumResults = self.context.bika_setup.getMinimumResults()
warning_icon = (
"<img "
+ "src='"
+ self.portal_url
+ "/++resource++bika.lims.images/warning.png' "
+ "height='9' width='9'/>"
)
error_icon = (
"<img "
+ "src='"
+ self.portal_url
+ "/++resource++bika.lims.images/exclamation.png' "
+ "height='9' width='9'/>"
)
header = _("Results per sample point")
subheader = _("Analysis results for per sample point and analysis service")
self.contentFilter = {
"portal_type": "Analysis",
"review_state": ["verified", "published"],
"sort_on": "getDateSampled",
}
spec = self.request.form.get("spec", "lab")
spec_title = (spec == "lab") and _("Lab") or _("Client")
parms = []
titles = []
val = self.selection_macros.parse_client(self.request)
if val:
self.contentFilter[val["contentFilter"][0]] = val["contentFilter"][1]
parms.append(val["parms"])
titles.append(val["titles"])
val = self.selection_macros.parse_samplepoint(self.request)
sp_uid = val
if val:
self.contentFilter[val["contentFilter"][0]] = val["contentFilter"][1]
parms.append(val["parms"])
titles.append(val["titles"])
val = self.selection_macros.parse_sampletype(self.request)
st_uid = val
if val:
self.contentFilter[val["contentFilter"][0]] = val["contentFilter"][1]
parms.append(val["parms"])
titles.append(val["titles"])
val = self.selection_macros.parse_analysisservice(self.request)
if val:
self.contentFilter[val["contentFilter"][0]] = val["contentFilter"][1]
parms.append(val["parms"])
else:
message = _("No analysis services were selected.")
self.context.plone_utils.addPortalMessage(message, "error")
return self.default_template()
val = self.selection_macros.parse_daterange(self.request, "getDateSampled", "DateSampled")
if val:
self.contentFilter[val["contentFilter"][0]] = val["contentFilter"][1]
parms.append(val["parms"])
titles.append(val["titles"])
val = self.selection_macros.parse_state(
self.request, "bika_worksheetanalysis_workflow", "worksheetanalysis_review_state", "Worksheet state"
)
if val:
self.contentFilter[val["contentFilter"][0]] = val["contentFilter"][1]
parms.append(val["parms"])
# Query the catalog and store analysis data in a dict
analyses = {}
out_of_range_count = 0
in_shoulder_range_count = 0
analysis_count = 0
proxies = self.bika_analysis_catalog(self.contentFilter)
if not proxies:
message = _("No analyses matched your query")
self.context.plone_utils.addPortalMessage(message, "error")
return self.default_template()
cached_specs = {} # keyed by parent_folder
#.........这里部分代码省略.........