Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
OpenGEODE
Commits
92b87f87
Commit
92b87f87
authored
May 12, 2020
by
Maxime Perrotin
Browse files
backport from Python2
parent
6318ab8d
Changes
1
Hide whitespace changes
Inline
Side-by-side
opengeode/CGenerator.py
View file @
92b87f87
...
...
@@ -1949,17 +1949,22 @@ def _sequence(seq):
for
elem
,
value
in
seq
.
value
.
items
():
# Set the type of the field - easy thanks to ASN.1 flattened AST
delem
=
elem
.
replace
(
'_'
,
'-'
)
found
=
False
for
each
in
type_children
:
if
each
.
lower
()
==
delem
.
lower
():
elem_spec
=
type_children
[
each
]
found
=
True
break
# try to use original children selector since elem is always lowercase
elem_name
=
each
.
replace
(
'-'
,
'_'
)
if
found
else
elem
elem_specty
=
elem_spec
.
type
value_stmts
,
value_str
,
local_var
=
expression
(
value
)
if
isinstance
(
value
,
(
ogAST
.
PrimSequenceOf
,
ogAST
.
PrimStringLiteral
)):
value_str
=
array_content
(
value
,
value_str
,
find_basic_type
(
elem_specty
))
elif
isinstance
(
value
,
(
ogAST
.
PrimSequenceOf
,
ogAST
.
PrimStringLiteral
)):
value_str
=
array_content
(
value
,
value_str
,
find_basic_type
(
elem_specty
))
string
+=
u
"{}.{} = {}"
.
format
(
sep
,
e
ach
.
replace
(
'-'
,
'_'
)
,
value_str
)
string
+=
u
"{}.{} = {}"
.
format
(
sep
,
e
lem_name
,
value_str
)
if
elem
.
lower
()
in
optional_fields
:
# Set optional field presence
optional_fields
[
elem
.
lower
()][
'present'
]
=
True
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment