Check if obj has one method

linkaiyi
Follow

Check if object has certain method

has_children = getattr(record_modify, 'get_children', None)
            if obj.valid_end >= record_modify.valid_end and callable(has_children):
                for child in record_modify.get_children():
                    child.parent = obj
Object has 0 attachments

Was this article helpful?

This article is viewed 13 times!

Recent Viewed Articles

0 Comments

Leave a Comment

Support