- # _philo_additional_template is a property philo provides on all nodes that require it
- # and which it monkeypatches onto the relevant default nodes.
- if hasattr(node, LOADED_TEMPLATE_ATTR) and getattr(node, LOADED_TEMPLATE_ATTR):
- nodes.extend(container_nodes(LOADED_TEMPLATE_ATTR))
+ # LOADED_TEMPLATE_ATTR contains the name of an attribute philo uses to declare a
+ # node as rendering an additional template. Philo monkeypatches the attribute onto
+ # the relevant default nodes.
+ if hasattr(node, LOADED_TEMPLATE_ATTR):
+ loaded_template = getattr(node, LOADED_TEMPLATE_ATTR)
+ if loaded_template:
+ nodes.extend(container_nodes(loaded_template))