One block on a template reference.
| 322 | |
| 323 | |
| 324 | class BlockReference(object): |
| 325 | """One block on a template reference.""" |
| 326 | |
| 327 | def __init__(self, name, context, stack, depth): |
| 328 | self.name = name |
| 329 | self._context = context |
| 330 | self._stack = stack |
| 331 | self._depth = depth |
| 332 | |
| 333 | @property |
| 334 | def super(self): |
| 335 | """Super the block.""" |
| 336 | if self._depth + 1 >= len(self._stack): |
| 337 | return self._context.environment. \ |
| 338 | undefined('there is no parent block called %r.' % |
| 339 | self.name, name='super') |
| 340 | return BlockReference(self.name, self._context, self._stack, |
| 341 | self._depth + 1) |
| 342 | |
| 343 | @internalcode |
| 344 | def __call__(self): |
| 345 | rv = concat(self._stack[self._depth](self._context)) |
| 346 | if self._context.eval_ctx.autoescape: |
| 347 | rv = Markup(rv) |
| 348 | return rv |
| 349 | |
| 350 | |
| 351 | class LoopContextBase(object): |
no outgoing calls
no test coverage detected