]> git.ipfire.org Git - thirdparty/python-fints.git/commitdiff
Use duck typing to break dependency hell
authorHenryk Plötz <henryk@ploetzli.ch>
Sat, 8 Sep 2018 19:15:19 +0000 (21:15 +0200)
committerRaphael Michel <mail@raphaelmichel.de>
Mon, 3 Dec 2018 18:34:29 +0000 (19:34 +0100)
fints/types.py

index a44a015d3a2d98f5af7190f3243f4865e4ba6a5e..e6e6b4a7e10f9209c7ba69b2b13d4a49bb4d97b0 100644 (file)
@@ -170,10 +170,9 @@ class SegmentSequence:
 
             if recurse:
                 for name, field in s._fields.items():
-                    if isinstance(field, fints.fields.SegmentSequenceField):
-                        val = getattr(s, name)
-                        if val:
-                            yield from val.find_segments(query=query, version=version, callback=callback, recurse=recurse)
+                    val = getattr(s, name)
+                    if val and hasattr(val, 'find_segments'):
+                        yield from val.find_segments(query=query, version=version, callback=callback, recurse=recurse)
 
     def find_segment_first(self, *args, **kwargs):
         """Finds the first matching segment.