|
31 | 31 | Text, |
32 | 32 | Comment, |
33 | 33 | DocumentType, |
| 34 | + Node, |
34 | 35 | ) |
35 | 36 | from .escaping import ( |
36 | 37 | escape_html_content_in_tag as default_escape_html_content_in_tag, |
@@ -819,13 +820,21 @@ def nodes_from_tcomponent(node_api, parent_node, template, maker_info): |
819 | 820 |
|
820 | 821 | result_template, context_values = invoke_component(component_callable, kwargs) |
821 | 822 |
|
822 | | - if result_template and result_template.strings != ("",): |
823 | | - assert not context_values |
824 | | - result_tnode = node_api.parse_template(result_template) |
825 | | - return to_render_node_queue_item( |
826 | | - parent_node, |
827 | | - iter(node_api.walk_subtree(parent_node, result_tnode, result_template)), |
828 | | - ) |
| 823 | + if isinstance(result_template, Template): |
| 824 | + if result_template.strings != ("",): |
| 825 | + if context_values: |
| 826 | + raise NotImplementedError("We have no implemented these yet.") |
| 827 | + result_tnode = node_api.parse_template(result_template) |
| 828 | + return to_render_node_queue_item( |
| 829 | + parent_node, |
| 830 | + iter(node_api.walk_subtree(parent_node, result_tnode, result_template)), |
| 831 | + ) |
| 832 | + # SHIM for old-style tail-call-style wrapping. |
| 833 | + elif isinstance(result_template, Node): |
| 834 | + if isinstance(result_template, Fragment): |
| 835 | + parent_node.children.extend(result_template.children) |
| 836 | + else: |
| 837 | + parent_node.children.append(result_template) |
829 | 838 |
|
830 | 839 |
|
831 | 840 | @dataclass(frozen=True) |
|
0 commit comments