Hello,
Can someone show me an example of how to create “analysis specificaton” by JSONAPI?
by the code in below, it could create an analysis specification with blank value.
i didn’t know how to set result range while creating analysis specification.
data = {
# “parent_id”: “bika_analysisspecs”,
“title”: spec_name,
“description”: DESC,
“portal_type”: “AnalysisSpec”,
“SampleType”: sampletype_UID,
“parent_path”: “/senaite/bika_setup/bika_analysisspecs”,
}
url = url_base + “/create”
requests.post(url, data=data, auth=auth)
thanks a lot in advance.
Deng
answered by myself, the issue related to
senaite:2.x
← fengyundeng:2.x
opened 03:53PM - 19 Nov 23 UTC
## Description of the issue/feature this PR addresses
Linked issue: https://g… ithub.com/senaite/senaite.core/issues/
## Current behavior before PR
in src/bika/lims/validators.py, line 818
request = kwargs.get("REQUEST", {})
request is None, when create analysisspec by JSONAPI.
then, in src/bika/lims/validators.py, line 829
service_uids = request.get("uids", [])
raise an error, 'NoneType' object has no attribute 'get'
## Desired behavior after PR is merged
fix the bug when "request" is None.
the analysisspec with "ResultsRange" by JSONAPI created work fine.
--
I confirm I have tested this PR thoroughly and coded it according to [PEP8][1]
and [Plone's Python styleguide][2] standards.
[1]: https://www.python.org/dev/peps/pep-0008
[2]: https://docs.plone.org/develop/styleguide/python.html
1 Like