Skip to content

Commit

Permalink
schema: fix leaf-list defaults
Browse files Browse the repository at this point in the history
Instanciate a Type module to be able to compare with Type enum. The next
commit will add unit tests.

Fixes: 806be4c ("Port to libyang 2")
Fixes: #80
Signed-off-by: Stefan Gula <[email protected]>
Signed-off-by: Samuel Gauthier <[email protected]>
  • Loading branch information
samuel-gauthier committed Jan 25, 2024
1 parent cccb9d6 commit 3b4d509
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libyang/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -1279,7 +1279,7 @@ def defaults(self) -> Iterator[str]:
if not val:
yield None
ret = c2str(val)
val_type = self.cdata_leaflist.dflts[i].realtype
val_type = Type(self.context, self.cdata_leaflist.dflts[i].realtype, None)
if val_type == Type.BOOL:
ret = val == "true"
elif val_type in Type.NUM_TYPES:
Expand Down

0 comments on commit 3b4d509

Please sign in to comment.