Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
PyI40AAS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lehrstuhl für Informations- und Automatisierungssysteme
PyI40AAS
Commits
78b54ba0
Commit
78b54ba0
authored
4 years ago
by
Leon Mauritz Möller
Committed by
Michael Thies
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
adapter.http fix type annotations of parse_request_body()
parent
e7bf718a
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
aas/adapter/http.py
+6
-4
6 additions, 4 deletions
aas/adapter/http.py
with
6 additions
and
4 deletions
aas/adapter/http.py
+
6
−
4
View file @
78b54ba0
...
...
@@ -27,7 +27,7 @@ from .xml import XMLConstructables, read_aas_xml_element, xml_serialization
from
.json
import
StrippedAASToJsonEncoder
,
StrictStrippedAASFromJsonDecoder
from
._generic
import
IDENTIFIER_TYPES
,
IDENTIFIER_TYPES_INVERSE
from
typing
import
Dict
,
Iterable
,
Optional
,
Tuple
,
Type
,
Union
from
typing
import
Dict
,
Iterable
,
Optional
,
Tuple
,
Type
,
TypeVar
,
Union
@enum.unique
...
...
@@ -216,7 +216,10 @@ def http_exception_to_response(exception: werkzeug.exceptions.HTTPException, res
return
response_type
(
result
,
status
=
exception
.
code
,
headers
=
headers
)
def
parse_request_body
(
request
:
Request
,
expect_type
:
Type
[
model
.
base
.
_RT
])
->
model
.
base
.
_RT
:
T
=
TypeVar
(
"
T
"
)
def
parse_request_body
(
request
:
Request
,
expect_type
:
Type
[
T
])
->
T
:
"""
TODO: werkzeug documentation recommends checking the content length before retrieving the body to prevent
running out of memory. but it doesn
'
t state how to check the content length
...
...
@@ -388,8 +391,7 @@ class WSGIApp:
aas_identifier
=
url_args
[
"
aas_id
"
]
aas
=
self
.
_get_obj_ts
(
aas_identifier
,
model
.
AssetAdministrationShell
)
aas
.
update
()
sm_ref
=
parse_request_body
(
request
,
model
.
AASReference
)
# type: ignore
assert
isinstance
(
sm_ref
,
model
.
AASReference
)
sm_ref
=
parse_request_body
(
request
,
model
.
AASReference
)
if
sm_ref
.
type
is
not
model
.
Submodel
:
raise
BadRequest
(
f
"
{
sm_ref
!r}
does not reference a Submodel!
"
)
# to give a location header in the response we have to be able to get the submodel identifier from the reference
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment