Skip to content

Commit 0bcd3fc

Browse files
jeanseb6windrjarry
authored andcommitted
schema: fix ordered return value
Currently, we use the compiled schema to retrieve the ordered state. It can't work since with the compiled node, it will always return True. In order to have the good behavior, we have to use the parsed schema.
1 parent 522b60c commit 0bcd3fc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libyang/schema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@ def __init__(self, context: "libyang.Context", cdata):
10971097
)
10981098

10991099
def ordered(self) -> bool:
1100-
return bool(self.cdata.flags & lib.LYS_ORDBY_USER)
1100+
return bool(self.cdata_parsed.flags & lib.LYS_ORDBY_USER)
11011101

11021102
def units(self) -> Optional[str]:
11031103
return c2str(self.cdata_leaflist.units)
@@ -1181,7 +1181,7 @@ def __init__(self, context: "libyang.Context", cdata):
11811181
self.cdata_list_parsed = ffi.cast("struct lysp_node_list *", self.cdata_parsed)
11821182

11831183
def ordered(self) -> bool:
1184-
return bool(self.cdata.flags & lib.LYS_ORDBY_USER)
1184+
return bool(self.cdata_parsed.flags & lib.LYS_ORDBY_USER)
11851185

11861186
def __iter__(self) -> Iterator[SNode]:
11871187
return self.children()

0 commit comments

Comments
 (0)