Adds self into appropriate BlockContext
(self)
| 87 | check_deprecated_parameters(self.__class__.__name__, **kwargs) |
| 88 | |
| 89 | def render(self): |
| 90 | """ |
| 91 | Adds self into appropriate BlockContext |
| 92 | """ |
| 93 | if Context.root_block is not None and self._id in Context.root_block.blocks: |
| 94 | raise DuplicateBlockError( |
| 95 | f"A block with id: {self._id} has already been rendered in the current Blocks." |
| 96 | ) |
| 97 | if Context.block is not None: |
| 98 | Context.block.add(self) |
| 99 | if Context.root_block is not None: |
| 100 | Context.root_block.blocks[self._id] = self |
| 101 | if hasattr(self, "temp_dir"): |
| 102 | Context.root_block.temp_dirs.add(self.temp_dir) |
| 103 | return self |
| 104 | |
| 105 | def unrender(self): |
| 106 | """ |