Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StringContainer.add_from_etree fails for empty node #53

Open
notEvil opened this issue Dec 11, 2024 · 0 comments
Open

StringContainer.add_from_etree fails for empty node #53

notEvil opened this issue Dec 11, 2024 · 0 comments

Comments

@notEvil
Copy link

notEvil commented Dec 11, 2024

Hi,

a perfectly valid invoice may contain for instance <IncludedNote><Content/></IncludedNote>. Container.add fails in this case as root.text is None. The following solves this issue:

--- models/container.py.orig	2024-12-11 10:20:20.833947854 +0100
+++ models/container.py	2024-12-11 10:20:24.930598120 +0100
@@ -91,4 +91,5 @@
         el._text = child
 
     def add_from_etree(self, root):
-        self.add(root.text)
+        if (_text := root.text) is not None:
+            self.add(_text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant